misc: refactor helpers propagation

Co-authored-by: Robert Hensing <robert@roberthensing.nl>
This commit is contained in:
Gaetan Lepage 2024-02-07 16:50:08 +01:00 committed by Gaétan Lepage
parent 3bbb3d5453
commit 5d3ed3a09e
12 changed files with 100 additions and 40 deletions

View file

@ -1,6 +1,7 @@
{
modules,
self,
getHelpers,
}: {
pkgs,
config,
@ -8,7 +9,8 @@
...
} @ args: let
inherit (lib) mkEnableOption mkOption mkOptionType mkMerge mkIf types;
shared = import ./_shared.nix modules args;
helpers = getHelpers pkgs;
shared = import ./_shared.nix {inherit modules helpers;} args;
cfg = config.programs.nixvim;
files =
shared.configFiles
@ -19,15 +21,20 @@ in {
options = {
programs.nixvim = mkOption {
default = {};
type = types.submodule ([
{
options = {
enable = mkEnableOption "nixvim";
defaultEditor = mkEnableOption "nixvim as the default editor";
};
}
]
++ shared.topLevelModules);
type = types.submoduleWith {
shorthandOnlyDefinesConfig = true;
specialArgs.helpers = helpers;
modules =
[
{
options = {
enable = mkEnableOption "nixvim";
defaultEditor = mkEnableOption "nixvim as the default editor";
};
}
]
++ shared.topLevelModules;
};
};
nixvim.helpers = shared.helpers;
};