From 26b1412b824b2737a6537e4f2c6646d9697e87d9 Mon Sep 17 00:00:00 2001 From: Poby <87608318+smg1024@users.noreply.github.com> Date: Sat, 14 Mar 2026 01:25:38 +0900 Subject: [PATCH] style: nix format --- Justfile | 2 +- flake.nix | 120 ++++++++++++++-------------- home/default.nix | 6 +- home/nvf/core/autocmds.nix | 9 ++- home/nvf/default.nix | 8 +- home/nvf/lsp/languages/bash.nix | 6 +- home/nvf/lsp/languages/default.nix | 3 +- home/nvf/lsp/languages/html.nix | 4 +- home/nvf/lsp/languages/lua.nix | 6 +- home/nvf/lsp/languages/markdown.nix | 4 +- home/nvf/lsp/languages/nix.nix | 2 +- home/nvf/lsp/languages/python.nix | 4 +- home/nvf/lsp/languages/yaml.nix | 2 +- home/nvf/plugins/fzf-lua.nix | 2 +- home/terminal.nix | 1 + home/zoxide.nix | 2 +- modules/apps.nix | 4 +- modules/host-users.nix | 5 +- modules/nix-core.nix | 10 ++- 19 files changed, 108 insertions(+), 92 deletions(-) diff --git a/Justfile b/Justfile index 2155836..13dc23b 100644 --- a/Justfile +++ b/Justfile @@ -1,6 +1,6 @@ # just is a command runner, Justfile is very similar to Makefile, but simpler. -# TODO update hostname here! +# FIXME update hostname here! hostname := "fenrir" # List all the just commands diff --git a/flake.nix b/flake.nix index 1b48fa4..295890c 100644 --- a/flake.nix +++ b/flake.nix @@ -42,73 +42,77 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - # agenix for secrets + # TODO: agenix for secrets agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs-darwin"; }; }; - outputs = inputs @ { - self, - nixpkgs, - darwin, - home-manager, - nvf, - agenix, - nix-homebrew, - homebrew-core, - homebrew-cask, - ... - }: let - system = "aarch64-darwin"; - username = "poby"; - useremail = "smg981024@gmail.com"; - hostname = "fenrir"; # TODO break down to multiple hosts + outputs = + inputs@{ + self, + nixpkgs, + darwin, + home-manager, + nvf, + agenix, + nix-homebrew, + homebrew-core, + homebrew-cask, + ... + }: + let + system = "aarch64-darwin"; + username = "poby"; + useremail = "smg981024@gmail.com"; + hostname = "fenrir"; # TODO break down to multiple hosts - specialArgs = - inputs - // { + specialArgs = inputs // { inherit username useremail hostname; }; - in { - darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { - inherit system specialArgs; - modules = [ - ./modules/nix-core.nix - ./modules/system.nix - ./modules/apps.nix - ./modules/host-users.nix - nix-homebrew.darwinModules.nix-homebrew - { - nix-homebrew = { - enable = true; - enableRosetta = true; - user = username; - taps = { - "homebrew/homebrew-core" = homebrew-core; - "homebrew/homebrew-cask" = homebrew-cask; + in + { + darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { + inherit system specialArgs; + modules = [ + ./modules/nix-core.nix + ./modules/system.nix + ./modules/apps.nix + ./modules/host-users.nix + nix-homebrew.darwinModules.nix-homebrew + { + nix-homebrew = { + enable = true; + enableRosetta = true; + user = username; + taps = { + "homebrew/homebrew-core" = homebrew-core; + "homebrew/homebrew-cask" = homebrew-cask; + }; + mutableTaps = false; }; - mutableTaps = false; - }; - } - ({config, ...}: { - homebrew.taps = builtins.attrNames config.nix-homebrew.taps; - }) - agenix.darwinModules.default - home-manager.darwinModules.home-manager - { - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - backupFileExtension = "backup"; - extraSpecialArgs = specialArgs; - sharedModules = [ nvf.homeManagerModules.nvf ]; - users.${username} = import ./home; - }; - } - ]; + } + ( + { config, ... }: + { + homebrew.taps = builtins.attrNames config.nix-homebrew.taps; + } + ) + agenix.darwinModules.default + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + backupFileExtension = "backup"; + extraSpecialArgs = specialArgs; + sharedModules = [ nvf.homeManagerModules.nvf ]; + users.${username} = import ./home; + }; + } + ]; + }; + formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; }; - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; - }; } diff --git a/home/default.nix b/home/default.nix index 46b05ed..533eccf 100755 --- a/home/default.nix +++ b/home/default.nix @@ -21,11 +21,15 @@ ./terminal.nix ./bat.nix ./aerospace.nix + # TODO ./browser.nix # TODO ./pass.nix + # TODO ./claude-code.nix + # TODO ./codex.nix + # TODO ./gemini-cli.nix ]; home = { - username = username; + inherit username; homeDirectory = "/Users/${username}"; stateVersion = "25.11"; diff --git a/home/nvf/core/autocmds.nix b/home/nvf/core/autocmds.nix index ff9fdda..2bdba3c 100755 --- a/home/nvf/core/autocmds.nix +++ b/home/nvf/core/autocmds.nix @@ -1,8 +1,9 @@ -{lib, ...}: [ +{ lib, ... }: +[ # autocmds { enable = true; - event = ["BufReadPost"]; + event = [ "BufReadPost" ]; desc = "Return to last cursor position"; group = "LastCursorGroup"; callback = lib.generators.mkLuaInline '' @@ -17,10 +18,10 @@ } { enable = true; - event = ["TextYankPost"]; + event = [ "TextYankPost" ]; desc = "Highlight yanks on copy"; group = "HighlightYank"; - pattern = ["*"]; + pattern = [ "*" ]; callback = lib.generators.mkLuaInline '' function() vim.hl.on_yank({ diff --git a/home/nvf/default.nix b/home/nvf/default.nix index 29a34dd..5430100 100755 --- a/home/nvf/default.nix +++ b/home/nvf/default.nix @@ -1,6 +1,7 @@ -{lib, ...}: let +{ lib, ... }: +let options = import ./core/options.nix; - autocmds = import ./core/autocmds.nix {inherit lib;}; + autocmds = import ./core/autocmds.nix { inherit lib; }; augroups = import ./core/augroups.nix; keymaps = import ./core/keymaps.nix; fzf-lua = import ./plugins/fzf-lua.nix; @@ -13,7 +14,8 @@ treesitter = import ./lsp/treesitter.nix; autocomplete = import ./lsp/autocomplete.nix; languages = import ./lsp/languages; -in { +in +{ programs.nvf = { enable = true; diff --git a/home/nvf/lsp/languages/bash.nix b/home/nvf/lsp/languages/bash.nix index 2205f03..8ace9c5 100755 --- a/home/nvf/lsp/languages/bash.nix +++ b/home/nvf/lsp/languages/bash.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = ["shellcheck"]; + types = [ "shellcheck" ]; }; format = { enable = true; - type = ["shfmt"]; + type = [ "shfmt" ]; }; lsp = { enable = true; - servers = ["bash-ls"]; + servers = [ "bash-ls" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/default.nix b/home/nvf/lsp/languages/default.nix index b67cb8b..cb73cc3 100755 --- a/home/nvf/lsp/languages/default.nix +++ b/home/nvf/lsp/languages/default.nix @@ -6,7 +6,8 @@ let markdown = import ./markdown.nix; html = import ./html.nix; yaml = import ./yaml.nix; -in { +in +{ inherit nix python diff --git a/home/nvf/lsp/languages/html.nix b/home/nvf/lsp/languages/html.nix index c0d3a7b..7f31f2c 100755 --- a/home/nvf/lsp/languages/html.nix +++ b/home/nvf/lsp/languages/html.nix @@ -3,7 +3,7 @@ enable = true; extraDiagnostics = { enable = true; - types = ["htmlhint"]; + types = [ "htmlhint" ]; }; format = { enable = true; @@ -14,7 +14,7 @@ }; lsp = { enable = true; - servers = ["superhtml"]; + servers = [ "superhtml" ]; }; treesitter = { enable = true; diff --git a/home/nvf/lsp/languages/lua.nix b/home/nvf/lsp/languages/lua.nix index 57c7de0..1947b1b 100755 --- a/home/nvf/lsp/languages/lua.nix +++ b/home/nvf/lsp/languages/lua.nix @@ -3,15 +3,15 @@ enable = true; extraDiagnostics = { enable = true; - types = ["luacheck"]; + types = [ "luacheck" ]; }; format = { enable = true; - type = ["stylua"]; + type = [ "stylua" ]; }; lsp = { enable = true; - servers = ["lua-language-server"]; + servers = [ "lua-language-server" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/markdown.nix b/home/nvf/lsp/languages/markdown.nix index 958bfff..ca1ee03 100755 --- a/home/nvf/lsp/languages/markdown.nix +++ b/home/nvf/lsp/languages/markdown.nix @@ -13,7 +13,7 @@ }; extraDiagnostics = { enable = true; - types = ["markdownlint-cli2"]; + types = [ "markdownlint-cli2" ]; }; format = { enable = true; @@ -24,7 +24,7 @@ }; lsp = { enable = true; - servers = ["marksman"]; + servers = [ "marksman" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/nix.nix b/home/nvf/lsp/languages/nix.nix index 8c9976b..d5f8d8e 100755 --- a/home/nvf/lsp/languages/nix.nix +++ b/home/nvf/lsp/languages/nix.nix @@ -17,7 +17,7 @@ }; lsp = { enable = true; - servers = ["nil"]; + servers = [ "nil" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/python.nix b/home/nvf/lsp/languages/python.nix index 13bcf1b..840716b 100755 --- a/home/nvf/lsp/languages/python.nix +++ b/home/nvf/lsp/languages/python.nix @@ -3,11 +3,11 @@ enable = true; format = { enable = true; - type = ["ruff"]; + type = [ "ruff" ]; }; lsp = { enable = true; - servers = ["pyright"]; + servers = [ "pyright" ]; }; treesitter.enable = true; } diff --git a/home/nvf/lsp/languages/yaml.nix b/home/nvf/lsp/languages/yaml.nix index 43fb599..35f914e 100755 --- a/home/nvf/lsp/languages/yaml.nix +++ b/home/nvf/lsp/languages/yaml.nix @@ -3,7 +3,7 @@ enable = true; lsp = { enable = true; - servers = ["yaml-language-server"]; + servers = [ "yaml-language-server" ]; }; treesitter.enable = true; } diff --git a/home/nvf/plugins/fzf-lua.nix b/home/nvf/plugins/fzf-lua.nix index f463c4a..d6ff206 100755 --- a/home/nvf/plugins/fzf-lua.nix +++ b/home/nvf/plugins/fzf-lua.nix @@ -2,5 +2,5 @@ # fzf-lua enable = true; profile = "default"; - setupOpts = {}; + setupOpts = { }; } diff --git a/home/terminal.nix b/home/terminal.nix index a1894c4..89c3118 100644 --- a/home/terminal.nix +++ b/home/terminal.nix @@ -3,5 +3,6 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; + # TODO wezterm config }; } diff --git a/home/zoxide.nix b/home/zoxide.nix index ac54e8f..2e51d3c 100755 --- a/home/zoxide.nix +++ b/home/zoxide.nix @@ -3,6 +3,6 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; - options = ["--cmd j"]; + options = [ "--cmd j" ]; }; } diff --git a/modules/apps.nix b/modules/apps.nix index a43d478..3a258ed 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -34,9 +34,7 @@ casks = [ "batfi" "hammerspoon" - # TODO use nixpkgs when possible - # "google-chrome" - "shottr" + "shottr" # stable version dmg link not found ]; }; } diff --git a/modules/host-users.nix b/modules/host-users.nix index 9df535e..5192d36 100644 --- a/modules/host-users.nix +++ b/modules/host-users.nix @@ -2,7 +2,8 @@ username, hostname, ... -}: { +}: +{ networking = { hostName = hostname; computerName = hostname; @@ -14,5 +15,5 @@ description = username; }; - nix.settings.trusted-users = [username]; + nix.settings.trusted-users = [ username ]; } diff --git a/modules/nix-core.nix b/modules/nix-core.nix index ed71a0d..c4da2d3 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -2,14 +2,18 @@ pkgs, lib, ... -}: { +}: +{ nix = { enable = true; package = pkgs.nix; settings = { - experimental-features = ["nix-command" "flakes"]; - substituters = ["https://nix-community.cachix.org"]; + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];