From 6b2bc536f7bd0ce35b863e991f252d622e34a3e9 Mon Sep 17 00:00:00 2001 From: Leonhard Kost Date: Thu, 12 Nov 2026 14:38:16 +0100 Subject: [PATCH] fix: fix all the missed errors --- flake.nix | 11 +++- home/nixvim.nix | 3 +- pkgs/default.nix | 9 +-- pkgs/nixvim/default.nix | 15 ++--- pkgs/nixvim/keymaps.nix | 2 +- pkgs/nixvim/opts.nix | 2 +- pkgs/nixvim/plugins/blink.nix | 28 ++++----- pkgs/nixvim/plugins/dap.nix | 98 +++++++++++++++--------------- pkgs/nixvim/plugins/default.nix | 8 +-- pkgs/nixvim/plugins/fmt.nix | 72 +++++++++++----------- pkgs/nixvim/plugins/lsp.nix | 76 +++++++++++------------ pkgs/nixvim/plugins/lualine.nix | 2 +- pkgs/nixvim/plugins/telescope.nix | 9 ++- pkgs/nixvim/plugins/treesitter.nix | 18 +++--- pkgs/nixvim/plugins/typst.nix | 10 ++- pkgs/nixvim/plugins/which-key.nix | 2 +- standalone/base.nix | 5 +- standalone/default.nix | 28 ++++----- system/nix.nix | 5 +- 19 files changed, 198 insertions(+), 205 deletions(-) diff --git a/flake.nix b/flake.nix index f7b09bb..bc6b329 100644 --- a/flake.nix +++ b/flake.nix @@ -40,7 +40,16 @@ { nixosConfigurations = import ./hosts { inherit self inputs; }; - homeConfigurations = import ./standalone { inherit self inputs; }; + # i. e. homeConfigurations.leonhard@x86_64-linux etc. + homeConfigurations = builtins.listToAttrs ( + map (system: { + name = "leonhard@${system}"; + value = import ./standalone { + pkgs = pkgsFor system; + inherit self inputs; + }; + }) (import systems) + ); packages = forAllSystems ( system: diff --git a/home/nixvim.nix b/home/nixvim.nix index cc85aa3..68c3206 100644 --- a/home/nixvim.nix +++ b/home/nixvim.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, self, ... }: @@ -8,6 +9,6 @@ options.nix-leonhard.neovim.enable = lib.mkEnableOption "neovim"; config = lib.mkIf config.nix-leonhard.neovim.enable { - home.packages = [ self.packages.nixvim ]; + home.packages = [ self.packages.${pkgs.system}.nixvim ]; }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 0fb74c7..53686a6 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,8 +4,9 @@ ... }: { - nixvim = inputs.nixvim.lib.buildNixvimWith { - inherit (pkgs) system; - modules = [ ./nixvim ]; - }; + nixvim = + (inputs.nixvim.lib.evalNixvim { + inherit (pkgs) system; + modules = [ ./nixvim ]; + }).config.build.package; } diff --git a/pkgs/nixvim/default.nix b/pkgs/nixvim/default.nix index 8e10bb3..440da86 100644 --- a/pkgs/nixvim/default.nix +++ b/pkgs/nixvim/default.nix @@ -5,17 +5,12 @@ ./plugins ]; - programs.nixvim = { - enable = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - defaultEditor = true; + viAlias = true; + vimAlias = true; - colorschemes.tokyonight.enable = true; + colorschemes.tokyonight.enable = true; - clipboard.providers.wl-copy.enable = true; + clipboard.providers.wl-copy.enable = true; - globals.mapleader = " "; - }; + globals.mapleader = " "; } diff --git a/pkgs/nixvim/keymaps.nix b/pkgs/nixvim/keymaps.nix index f715318..077da4c 100644 --- a/pkgs/nixvim/keymaps.nix +++ b/pkgs/nixvim/keymaps.nix @@ -1,5 +1,5 @@ { - programs.nixvim.keymaps = [ + keymaps = [ { mode = "n"; key = ""; diff --git a/pkgs/nixvim/opts.nix b/pkgs/nixvim/opts.nix index 27c9f32..c1ac518 100644 --- a/pkgs/nixvim/opts.nix +++ b/pkgs/nixvim/opts.nix @@ -1,5 +1,5 @@ { - programs.nixvim.opts = { + opts = { number = true; relativenumber = true; showmode = false; diff --git a/pkgs/nixvim/plugins/blink.nix b/pkgs/nixvim/plugins/blink.nix index 996faf4..7711d89 100644 --- a/pkgs/nixvim/plugins/blink.nix +++ b/pkgs/nixvim/plugins/blink.nix @@ -1,19 +1,17 @@ { - programs.nixvim = { - plugins = { - blink-indent.enable = true; - blink-pairs.enable = true; - blink-cmp = { - enable = true; - settings = { - signature.enabled = true; - keymap = { - preset = "default"; - "" = [ - "accept" - "fallback" - ]; - }; + plugins = { + blink-indent.enable = true; + blink-pairs.enable = true; + blink-cmp = { + enable = true; + settings = { + signature.enabled = true; + keymap = { + preset = "default"; + "" = [ + "accept" + "fallback" + ]; }; }; }; diff --git a/pkgs/nixvim/plugins/dap.nix b/pkgs/nixvim/plugins/dap.nix index 8f8c369..80b633f 100644 --- a/pkgs/nixvim/plugins/dap.nix +++ b/pkgs/nixvim/plugins/dap.nix @@ -1,53 +1,51 @@ { - programs.nixvim = { - plugins.dap = { - enable = true; - luaConfig.content = '' - local dap = require 'dap' - local dapui = require 'dapui' - dap.listeners.after.event_initialized['dapui_config'] = dapui.open - dap.listeners.before.event_terminated['dapui_config'] = dapui.close - dap.listeners.before.event_exited['dapui_config'] = dapui.close - ''; - }; - plugins.dap-ui.enable = true; - plugins.dap-python.enable = true; - keymaps = [ - { - mode = "n"; - key = ""; - action = "DapContinue"; - options.desc = "Debug: Start/Continue"; - options.silent = true; - } - { - mode = "n"; - key = ""; - action = "DapStepInto"; - options.desc = "Debug: Step Into"; - options.silent = true; - } - { - mode = "n"; - key = ""; - action = "DapStepOver"; - options.desc = "Debug: Step Over"; - options.silent = true; - } - { - mode = "n"; - key = ""; - action = "DapStepOut"; - options.desc = "Debug: Step Out"; - options.silent = true; - } - { - mode = "n"; - key = "b"; - action = "DapToggleBreakpoint"; - options.desc = "Debug: Toggle Breakpoint"; - options.silent = true; - } - ]; + plugins.dap = { + enable = true; + luaConfig.content = '' + local dap = require 'dap' + local dapui = require 'dapui' + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + ''; }; + plugins.dap-ui.enable = true; + plugins.dap-python.enable = true; + keymaps = [ + { + mode = "n"; + key = ""; + action = "DapContinue"; + options.desc = "Debug: Start/Continue"; + options.silent = true; + } + { + mode = "n"; + key = ""; + action = "DapStepInto"; + options.desc = "Debug: Step Into"; + options.silent = true; + } + { + mode = "n"; + key = ""; + action = "DapStepOver"; + options.desc = "Debug: Step Over"; + options.silent = true; + } + { + mode = "n"; + key = ""; + action = "DapStepOut"; + options.desc = "Debug: Step Out"; + options.silent = true; + } + { + mode = "n"; + key = "b"; + action = "DapToggleBreakpoint"; + options.desc = "Debug: Toggle Breakpoint"; + options.silent = true; + } + ]; } diff --git a/pkgs/nixvim/plugins/default.nix b/pkgs/nixvim/plugins/default.nix index 7a48b59..6cc50e6 100644 --- a/pkgs/nixvim/plugins/default.nix +++ b/pkgs/nixvim/plugins/default.nix @@ -11,9 +11,7 @@ ./which-key.nix ]; - programs.nixvim = { - extraPlugins = with pkgs.vimPlugins; [ - vim-sleuth - ]; - }; + extraPlugins = with pkgs.vimPlugins; [ + vim-sleuth + ]; } diff --git a/pkgs/nixvim/plugins/fmt.nix b/pkgs/nixvim/plugins/fmt.nix index f2dec16..95aa7e9 100644 --- a/pkgs/nixvim/plugins/fmt.nix +++ b/pkgs/nixvim/plugins/fmt.nix @@ -1,45 +1,43 @@ { pkgs, ... }: { - programs.nixvim = { - opts.formatexpr = "v:lua.require'conform'.formatexpr()"; + opts.formatexpr = "v:lua.require'conform'.formatexpr()"; - keymaps = [ - { - key = "f"; - action.__raw = '' - function() require 'conform'.format { async = true } end - ''; - options.desc = "Format Buffer"; - } - ]; + keymaps = [ + { + key = "f"; + action.__raw = '' + function() require 'conform'.format { async = true } end + ''; + options.desc = "Format Buffer"; + } + ]; - plugins.conform-nvim = { - enable = true; - settings = { - default_format_opts.lsp_format = "fallback"; - format_on_save = { - lsp_format = "fallback"; - timeout_ms = 500; - }; - - formatters_by_ft = { - c = [ "clang-format" ]; - lua = [ "stylua" ]; - nix = [ "nixfmt" ]; - python = [ "ruff_format" ]; - }; - - formatters.clang-format.prepend_args = [ - "--style=file" - "--fallback-style=LLVM" - ]; + plugins.conform-nvim = { + enable = true; + settings = { + default_format_opts.lsp_format = "fallback"; + format_on_save = { + lsp_format = "fallback"; + timeout_ms = 500; }; - }; - extraPackages = with pkgs; [ - stylua - nixfmt - ruff - ]; + formatters_by_ft = { + c = [ "clang-format" ]; + lua = [ "stylua" ]; + nix = [ "nixfmt" ]; + python = [ "ruff_format" ]; + }; + + formatters.clang-format.prepend_args = [ + "--style=file" + "--fallback-style=LLVM" + ]; + }; }; + + extraPackages = with pkgs; [ + stylua + nixfmt + ruff + ]; } diff --git a/pkgs/nixvim/plugins/lsp.nix b/pkgs/nixvim/plugins/lsp.nix index 7815f00..1519606 100644 --- a/pkgs/nixvim/plugins/lsp.nix +++ b/pkgs/nixvim/plugins/lsp.nix @@ -3,60 +3,58 @@ ./typst.nix ]; - programs.nixvim = { - diagnostic.settings = { - severity_sort = true; - float = { - border = "rounded"; - source = "if_many"; - }; - signs.text.__raw = "{ + diagnostic.settings = { + severity_sort = true; + float = { + border = "rounded"; + source = "if_many"; + }; + signs.text.__raw = "{ [vim.diagnostic.severity.ERROR] = '󰅚 ', [vim.diagnostic.severity.WARN] = '󰀪 ', [vim.diagnostic.severity.INFO] = '󰋽 ', [vim.diagnostic.severity.HINT] = '󰌶 ', }"; - virtual_text = { - source = "if_many"; - spacing = 2; - format.__raw = " + virtual_text = { + source = "if_many"; + spacing = 2; + format.__raw = " function(diagnostic) return diagnostic.message end "; - }; }; + }; - plugins = { - lsp = { - enable = true; + plugins = { + lsp = { + enable = true; - keymaps = { - silent = true; - lspBuf = { - "gd" = "definition"; - "gD" = "declaration"; - "gr" = "references"; - "gI" = "implementation"; - "ca" = "code_action"; - "D" = "type_definition"; - "rn" = "rename"; - }; + keymaps = { + silent = true; + lspBuf = { + "gd" = "definition"; + "gD" = "declaration"; + "gr" = "references"; + "gI" = "implementation"; + "ca" = "code_action"; + "D" = "type_definition"; + "rn" = "rename"; }; + }; - servers = { - lua_ls.enable = true; - nil_ls.enable = true; - basedpyright.enable = true; - ts_ls.enable = true; - vue_ls.enable = true; - rust_analyzer = { - enable = true; - installCargo = false; - installRustc = false; - }; - clangd.enable = true; + servers = { + lua_ls.enable = true; + nil_ls.enable = true; + basedpyright.enable = true; + ts_ls.enable = true; + vue_ls.enable = true; + rust_analyzer = { + enable = true; + installCargo = false; + installRustc = false; }; + clangd.enable = true; }; }; }; diff --git a/pkgs/nixvim/plugins/lualine.nix b/pkgs/nixvim/plugins/lualine.nix index 416ddf2..7a838b1 100644 --- a/pkgs/nixvim/plugins/lualine.nix +++ b/pkgs/nixvim/plugins/lualine.nix @@ -1,5 +1,5 @@ { - programs.nixvim.plugins.lualine = { + plugins.lualine = { enable = true; settings = { options = { diff --git a/pkgs/nixvim/plugins/telescope.nix b/pkgs/nixvim/plugins/telescope.nix index f2facc3..f88f17a 100644 --- a/pkgs/nixvim/plugins/telescope.nix +++ b/pkgs/nixvim/plugins/telescope.nix @@ -1,10 +1,6 @@ { pkgs, ... }: { - home.packages = with pkgs; [ - ripgrep - ]; - - programs.nixvim.plugins.telescope = { + plugins.telescope = { enable = true; extensions.fzf-native.enable = true; keymaps = { @@ -43,4 +39,7 @@ "%.ipynb" ]; }; + extraPackages = with pkgs; [ + ripgrep + ]; } diff --git a/pkgs/nixvim/plugins/treesitter.nix b/pkgs/nixvim/plugins/treesitter.nix index 0da4652..3945103 100644 --- a/pkgs/nixvim/plugins/treesitter.nix +++ b/pkgs/nixvim/plugins/treesitter.nix @@ -1,14 +1,12 @@ { pkgs, ... }: { - programs.nixvim = { - plugins.treesitter = { - enable = true; - highlight.enable = true; - indent.enable = true; - }; - - extraPackages = with pkgs; [ - gcc - ]; + plugins.treesitter = { + enable = true; + highlight.enable = true; + indent.enable = true; }; + + extraPackages = with pkgs; [ + gcc + ]; } diff --git a/pkgs/nixvim/plugins/typst.nix b/pkgs/nixvim/plugins/typst.nix index 4730409..fdafb7a 100644 --- a/pkgs/nixvim/plugins/typst.nix +++ b/pkgs/nixvim/plugins/typst.nix @@ -1,10 +1,8 @@ { - programs.nixvim = { - dependencies.tinymist.enable = true; - dependencies.websocat.enable = true; + dependencies.tinymist.enable = true; + dependencies.websocat.enable = true; - plugins.typst-preview.enable = true; + plugins.typst-preview.enable = true; - plugins.lsp.servers.tinymist.enable = true; - }; + plugins.lsp.servers.tinymist.enable = true; } diff --git a/pkgs/nixvim/plugins/which-key.nix b/pkgs/nixvim/plugins/which-key.nix index 4f65cc9..6d02309 100644 --- a/pkgs/nixvim/plugins/which-key.nix +++ b/pkgs/nixvim/plugins/which-key.nix @@ -1,3 +1,3 @@ { - programs.nixvim.plugins.which-key.enable = true; + plugins.which-key.enable = true; } diff --git a/standalone/base.nix b/standalone/base.nix index 98a3f6a..25fbe40 100644 --- a/standalone/base.nix +++ b/standalone/base.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, inputs, ... }: @@ -10,6 +11,8 @@ flakeInputs = lib.filterAttrs (_: v: lib.isType "flake" v) inputs; in { + package = pkgs.nix; + # pin the registry to avoid downloading and evaling a new nixpkgs version every time registry = lib.mapAttrs (_: v: { flake = v; }) flakeInputs; @@ -17,8 +20,6 @@ nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; settings.experimental-features = "nix-command flakes"; - - channels.enable = false; }; programs.home-manager.enable = true; diff --git a/standalone/default.nix b/standalone/default.nix index fce48d9..14595e4 100644 --- a/standalone/default.nix +++ b/standalone/default.nix @@ -1,25 +1,23 @@ { pkgs, + self, inputs, ... }: let inherit (inputs.home-manager.lib) homeManagerConfiguration; - extraSpecialArgs = { inherit inputs; }; + extraSpecialArgs = { inherit self inputs; }; in -{ - leonhard = homeManagerConfiguration { - inherit pkgs extraSpecialArgs; - modules = [ - ./base.nix - ../home - ../options.nix - { - nix-leonhard.graphical = false; - nix-leonhard.neovim.enable = true; - nix-leonhard.neovim.typst.enable = true; - } - ]; - }; +homeManagerConfiguration { + inherit pkgs extraSpecialArgs; + modules = [ + ./base.nix + ../home + ../options.nix + { + nix-leonhard.graphical = false; + nix-leonhard.neovim.enable = true; + } + ]; } diff --git a/system/nix.nix b/system/nix.nix index 1ce4811..467a1aa 100644 --- a/system/nix.nix +++ b/system/nix.nix @@ -1,6 +1,7 @@ { config, lib, + pkgs, inputs, ... }: @@ -10,6 +11,8 @@ flakeInputs = lib.filterAttrs (_: v: lib.isType "flake" v) inputs; in { + package = pkgs.nix; + # pin the registry to avoid downloading and evaling a new nixpkgs version every time registry = lib.mapAttrs (_: v: { flake = v; }) flakeInputs; @@ -21,6 +24,6 @@ "flakes" ]; - channels.enable = false; + channel.enable = false; }; }