nixos: Check for duplicate assignments

This commit is contained in:
2022-06-11 16:33:32 +01:00
parent 58b2c6d8c5
commit 1f51a3ec08
3 changed files with 66 additions and 17 deletions

View File

@@ -2,7 +2,7 @@
let
inherit (builtins) head tail mapAttrs attrValues;
inherit (lib) flatten optional mkOption mkDefault mkOptionType;
inherit (lib.my) homeStateVersion mkOpt' commonOpts inlineModule';
inherit (lib.my) homeStateVersion mkOpt' commonOpts inlineModule' applyAssertions;
cfg = config.home-manager;
@@ -40,7 +40,11 @@ let
] ++ (tail defs);
};
homeOpts = with lib.types; { config, ... }: {
homeOpts = with lib.types; { ... }@args:
let
config' = args.config;
in
{
options = {
inherit (commonOpts) system nixpkgs home-manager;
# TODO: docCustom for home-manager?
@@ -53,16 +57,16 @@ let
description = "home-manager configuration module.";
type = mkOptionType {
name = "home-manager configuration";
merge = _: defs: mkHome {
config' = config;
merge = _: defs: applyAssertions config (mkHome {
inherit config';
defs = map (d: inlineModule' d.file d.value) defs;
};
});
};
};
};
config = {
nixpkgs = mkDefault config.home-manager;
nixpkgs = mkDefault config'.home-manager;
};
};
in