diff options
| Commit | 30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409 (patch) | |
|---|---|---|
| Author | 2024-09-08 10:12:17 +0300 | |
| Committer | 2024-09-08 10:12:17 +0300 | |
| Files | 7f5b0b10a8cc4fa67354226d516860f96ef48ad2 /autoconfig.nix | |
| nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.tar nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.tar.gz nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.zip | ||
| Parent | aa3a132596e01b8bf15c6ca12cb23750c2d1875a (diff) | |
feat(autoconfig)!: Significantly simplified module inclusion/exclusion via sysidentity
1 files changed, 7 insertions, 16 deletions
| -rw-r--r-- | autoconfig.nix | 23 |
diff --git a/autoconfig.nix b/autoconfig.nix index cd40ee7..5debdc2 100644 --- a/autoconfig.nix +++ b/autoconfig.nix @@ -7,33 +7,24 @@ in { lib.mapAttrs (dir: _: let - sysidentity = import ./machines/${dir}/sysidentity.nix; + sysidentity = (import ./machines/${dir}/sysidentity.nix) (import ./module-groups.nix); + # TODO: rework modules-dir = ./modules + ("/" + (if sysidentity ? "modules-subpath" then sysidentity.modules-subpath else "personal")); package-modules = let - listget = attrname: + getmodules = attrname: if sysidentity ? ${attrname} then map (v: modules-dir + ("/" + v + (if lib.hasSuffix ".nix" v then "" else ".nix"))) sysidentity.${attrname} else []; - droplist = listget "drop"; - startsempty = (sysidentity ? defaultempty) && sysidentity.defaultempty; - # When we start empty, we expect to have many packages in "have" - # but when we don't start empty, we expect to have many packages in "modelist" - # So it makes more sense to make droplist remove items from the "many packages" - # list, instead of only one of the two, or both - havelist = if startsempty then listget "have" else []; - modulelist = - if startsempty - then listget "have" - else lib.mapAttrsToList - (name: _: modules-dir + ("/" + name)) - (lib.filterAttrs (_: type: type == "regular") (builtins.readDir modules-dir)); + + includelist = getmodules "include"; + excludelist = getmodules "exclude"; in - (lib.subtractLists droplist modulelist) ++ havelist; + lib.subtractLists excludelist includelist; inputs-overlays = lib.mapAttrs |
