refactor(flake): reduce nvim duplication

Also export smaller standalone nvim configurations
This commit is contained in:
Jalil David Salamé Messina 2024-11-06 22:42:16 +01:00
parent e26eceb10c
commit c0d70b3146
Signed by: jalil
GPG key ID: F016B9E770737A0B

View file

@ -7,15 +7,8 @@
let let
nixvimLib = inputs.nixvim.lib.${system}; nixvimLib = inputs.nixvim.lib.${system};
nixvim = inputs.nixvim.legacyPackages.${system}; nixvim = inputs.nixvim.legacyPackages.${system};
moduleDev = { testNvimModule = nixvimLib.check.mkTestDerivationFromNixvimModule;
inherit pkgs; nvimModule = extraConfig: {
extraSpecialArgs = {
inherit (inputs) unstable;
inherit system;
};
module = import ../nvim/standalone.nix { standalone = true; };
};
moduleHeadless = {
inherit pkgs; inherit pkgs;
extraSpecialArgs = { extraSpecialArgs = {
inherit (inputs) unstable; inherit (inputs) unstable;
@ -23,57 +16,37 @@
}; };
module = { module = {
imports = [ (import ../nvim/standalone.nix { standalone = true; }) ]; imports = [ (import ../nvim/standalone.nix { standalone = true; }) ];
config.jhome.nvim.dev.enable = false; config = extraConfig;
}; };
}; };
moduleNoLsp = { moduleDev = nvimModule { };
inherit pkgs; moduleHeadless = nvimModule { jhome.nvim.dev.enable = false; };
extraSpecialArgs = { moduleNoLsp = nvimModule { jhome.nvim.dev.bundleLSPs = false; };
inherit (inputs) unstable; moduleNoTSGrammars = nvimModule { jhome.nvim.dev.bundleGrammars = false; };
inherit system; moduleNoBundledBins = nvimModule {
}; jhome.nvim.dev = {
module = { bundleLSPs = false;
imports = [ (import ../nvim/standalone.nix { standalone = true; }) ]; bundleGrammars = false;
config.jhome.nvim.dev.bundleLSPs = false;
};
};
moduleNoTSGrammars = {
inherit pkgs;
extraSpecialArgs = {
inherit (inputs) unstable;
inherit system;
};
module = {
imports = [ (import ../nvim/standalone.nix { standalone = true; }) ];
config.jhome.nvim.dev.bundleGrammars = false;
};
};
moduleNoBundledBins = {
inherit pkgs;
extraSpecialArgs = {
inherit (inputs) unstable;
inherit system;
};
module = {
imports = [ (import ../nvim/standalone.nix { standalone = true; }) ];
config.jhome.nvim.dev = {
bundleLSPs = false;
bundleGrammars = false;
};
}; };
}; };
in in
{ {
# Check standalone nvim build # Check standalone nvim build
checks = { checks = {
nvimDev = nixvimLib.check.mkTestDerivationFromNixvimModule moduleDev; nvimDev = testNvimModule moduleDev;
nvimHeadless = nixvimLib.check.mkTestDerivationFromNixvimModule moduleHeadless; nvimHeadless = testNvimModule moduleHeadless;
nvimNoLsp = nixvimLib.check.mkTestDerivationFromNixvimModule moduleNoLsp; nvimNoLsp = testNvimModule moduleNoLsp;
nvimNoTSGrammars = nixvimLib.check.mkTestDerivationFromNixvimModule moduleNoTSGrammars; nvimNoTSGrammars = testNvimModule moduleNoTSGrammars;
nvimNoBundledBins = nixvimLib.check.mkTestDerivationFromNixvimModule moduleNoBundledBins; nvimNoBundledBins = testNvimModule moduleNoBundledBins;
}; };
# Nvim standalone module # Nvim standalone module
packages.nvim = nixvim.makeNixvimWithModule moduleDev; packages = {
nvim = nixvim.makeNixvimWithModule moduleDev;
# Smaller derivations
nvim-small = nixvim.makeNixvimWithModule moduleNoBundledBins;
nvim-no-ts = nixvim.makeNixvimWithModule moduleNoTSGrammars;
nvim-no-lsps = nixvim.makeNixvimWithModule moduleNoLsp;
};
}; };
} }