configuration.nix/flake-modules/nvim.nix
Jalil David Salamé Messina 7963190ef1
fix(nvim): conflict with using global packages
Now it is an error to override the pkgs if global packages are being
used.
2025-01-18 11:41:26 +01:00

49 lines
1.6 KiB
Nix

{ inputs, ... }:
{
flake.overlays.nixvim = inputs.nixvim.overlays.default;
perSystem =
{ system, ... }:
let
nixvimLib = inputs.nixvim.lib.${system};
nixvim = inputs.nixvim.legacyPackages.${system};
testNvimModule = nixvimLib.check.mkTestDerivationFromNixvimModule;
nvimModule = extraConfig: {
pkgs = inputs.unstable.legacyPackages.${system};
module = {
imports = [ ../nvim/standalone.nix ];
config = extraConfig;
};
};
moduleDev = nvimModule { };
moduleHeadless = nvimModule { jhome.nvim.dev.enable = false; };
moduleNoLsp = nvimModule { jhome.nvim.dev.bundleLSPs = false; };
moduleNoTSGrammars = nvimModule { jhome.nvim.dev.bundleGrammars = false; };
moduleNoBundledBins = nvimModule {
jhome.nvim.dev = {
bundleLSPs = false;
bundleGrammars = false;
};
};
in
{
# Check standalone nvim build
checks = {
nvimDev = testNvimModule moduleDev;
nvimHeadless = testNvimModule moduleHeadless;
nvimNoLsp = testNvimModule moduleNoLsp;
nvimNoTSGrammars = testNvimModule moduleNoTSGrammars;
nvimNoBundledBins = testNvimModule moduleNoBundledBins;
};
# Nvim standalone module
packages = {
nvim = nixvim.makeNixvimWithModule moduleDev;
# Smaller derivations
nvim-headless = nixvim.makeNixvimWithModule moduleHeadless;
nvim-small = nixvim.makeNixvimWithModule moduleNoBundledBins;
nvim-no-ts = nixvim.makeNixvimWithModule moduleNoTSGrammars;
nvim-no-lsps = nixvim.makeNixvimWithModule moduleNoLsp;
};
};
}