nix-community.nixvim/wrappers/hm.nix
Matt Sturgeon cb2b76c1a9
docs/home-manager: eval options without checking config definitions
By default `lib.evalModules` will check all config definitions match
a declared option (or a freeform type), leading to errors like:

    error: The option `wrapRc' does not exist.

Setting `_module.freeformType` or `_module.check` will disable this,
allowing us to evaluate the option declaration without checking the
config definitions.
2024-09-27 02:56:28 +01:00

61 lines
1.1 KiB
Nix

self:
{
pkgs,
config,
lib,
...
}@args:
let
inherit (lib)
mkEnableOption
mkOption
mkOptionType
mkMerge
mkIf
types
;
cfg = config.programs.nixvim;
nixvimConfig = config.lib.nixvim.modules.evalNixvim {
extraSpecialArgs = {
defaultPkgs = pkgs;
hmConfig = config;
};
modules = [
./modules/hm.nix
];
};
in
{
_file = ./hm.nix;
options = {
programs.nixvim = mkOption {
inherit (nixvimConfig) type;
default = { };
};
};
imports = [
(import ./_shared.nix {
filesOpt = [
"xdg"
"configFile"
];
})
];
config = mkIf cfg.enable {
home.packages = [
cfg.build.package
cfg.build.printInitPackage
] ++ lib.optional cfg.enableMan self.packages.${pkgs.stdenv.hostPlatform.system}.man-docs;
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; };
programs = mkIf cfg.vimdiffAlias {
bash.shellAliases.vimdiff = "nvim -d";
fish.shellAliases.vimdiff = "nvim -d";
zsh.shellAliases.vimdiff = "nvim -d";
};
};
}