From 8b2984be908cbe5c368b39c8e5eff236db590624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Mon, 14 Oct 2024 09:31:19 +0200 Subject: [PATCH] fix(nvim): use unstable pkgset Instead of setting some specific unstable packages, make nixvim always use packages from nixos-unstable. --- flake-modules/nixos-modules.nix | 15 +++++++++++---- flake-modules/nvim.nix | 6 +++++- flake-modules/overlays.nix | 2 -- nvim/default.nix | 4 +++- nvim/plugins.nix | 2 +- nvim/standalone.nix | 32 ++++++++++++++++++++------------ 6 files changed, 40 insertions(+), 21 deletions(-) diff --git a/flake-modules/nixos-modules.nix b/flake-modules/nixos-modules.nix index f390328..2e98ee4 100644 --- a/flake-modules/nixos-modules.nix +++ b/flake-modules/nixos-modules.nix @@ -2,10 +2,17 @@ { flake.nixosModules = let - nvim-config.imports = [ - inputs.nixvim.homeManagerModules.nixvim - ../nvim - ]; + nvim-config = + { pkgs, ... }: + { + imports = [ + inputs.nixvim.homeManagerModules.nixvim + (import ../nvim { + inherit (inputs) unstable; + inherit (pkgs) system; + }) + ]; + }; homeManagerModuleSandalone = import ../home { inherit nvim-config; inherit (inputs) stylix; diff --git a/flake-modules/nvim.nix b/flake-modules/nvim.nix index a143ff1..00aadc3 100644 --- a/flake-modules/nvim.nix +++ b/flake-modules/nvim.nix @@ -9,7 +9,11 @@ nixvim = inputs.nixvim.legacyPackages.${system}; module = { inherit pkgs; - module = ../nvim/standalone.nix; + extraSpecialArgs = { + inherit (inputs) unstable; + inherit system; + }; + module = import ../nvim/standalone.nix { standalone = true; }; }; in { diff --git a/flake-modules/overlays.nix b/flake-modules/overlays.nix index 62e46dd..437797c 100644 --- a/flake-modules/overlays.nix +++ b/flake-modules/overlays.nix @@ -17,8 +17,6 @@ inherit (unstablePkgs) gitoxide jujutsu - neovim-unwrapped - ruff # nixpkgs stable version is improperly configured by nixvim # wezterm ; }; diff --git a/nvim/default.nix b/nvim/default.nix index 3e304dd..ce16984 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -1,3 +1,4 @@ +{ system, unstable }: { lib, config, ... }: let cfg = config.jhome.nvim; @@ -6,8 +7,9 @@ in imports = [ ./options.nix ]; config.programs.nixvim = lib.mkMerge [ - ./standalone.nix + (import ./standalone.nix { standalone = false; }) (lib.mkIf cfg.enable { + nixpkgs = lib.mkForce { pkgs = import unstable { inherit system; }; }; enable = true; defaultEditor = lib.mkDefault true; }) diff --git a/nvim/plugins.nix b/nvim/plugins.nix index 3c2f67d..7e5f818 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -183,7 +183,7 @@ in servers = { bashls = { enable = true; - package = pkgs.unstable.bash-language-server; + package = pkgs.bash-language-server; }; # clangd.enable = true; # Adds ~2GiB # html.enable = true; # Not writing html diff --git a/nvim/standalone.nix b/nvim/standalone.nix index b5f13e8..cc48d20 100644 --- a/nvim/standalone.nix +++ b/nvim/standalone.nix @@ -1,4 +1,11 @@ -{ pkgs, ... }: +{ standalone }: +{ + pkgs, + system, + unstable, + lib, + ... +}: { imports = [ ./options.nix @@ -8,6 +15,7 @@ ]; config = { + nixpkgs = lib.optionalAttrs standalone { pkgs = import unstable { inherit system; }; }; globals.mapleader = " "; # Appearance colorschemes.gruvbox = { @@ -42,8 +50,8 @@ }; extraPlugins = let - plugins = pkgs.unstable.vimPlugins; - extraPlugins = import ./extraPlugins { pkgs = pkgs.unstable; }; + plugins = pkgs.vimPlugins; + extraPlugins = import ./extraPlugins { inherit pkgs; }; in [ plugins.nui-nvim @@ -53,15 +61,15 @@ ]; # Formatting & linters extraPackages = [ - pkgs.unstable.luajitPackages.jsregexp - pkgs.unstable.shfmt - pkgs.unstable.silicon - pkgs.unstable.statix - pkgs.unstable.stylua - pkgs.unstable.taplo - pkgs.unstable.typos - pkgs.unstable.yamlfmt - (pkgs.unstable.python3.withPackages (p: [ p.jupytext ])) + pkgs.luajitPackages.jsregexp + pkgs.shfmt + pkgs.silicon + pkgs.statix + pkgs.stylua + pkgs.taplo + pkgs.typos + pkgs.yamlfmt + (pkgs.python3.withPackages (p: [ p.jupytext ])) ]; extraConfigLuaPre = # lua