diff options
| Commit | 30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409 (patch) | |
|---|---|---|
| Author | 2024-09-08 10:12:17 +0300 | |
| Committer | 2024-09-08 10:12:17 +0300 | |
| Files | 7f5b0b10a8cc4fa67354226d516860f96ef48ad2 | |
| nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.tar nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.tar.gz nix-30ddf7732ecf0c4c5d1b406d3f8e65dd8d87a409.zip | ||
| Parent | aa3a132596e01b8bf15c6ca12cb23750c2d1875a (diff) | |
feat(autoconfig)!: Significantly simplified module inclusion/exclusion via sysidentity
5 files changed, 30 insertions, 38 deletions
| -rw-r--r-- | autoconfig.nix | 23 | ||||
| -rw-r--r-- | machines/juno/sysidentity.nix | 9 | ||||
| -rw-r--r-- | machines/minerva/sysidentity.nix | 9 | ||||
| -rw-r--r-- | machines/vesta/sysidentity.nix | 7 | ||||
| -rw-r--r-- | module-groups.nix | 20 |
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 diff --git a/machines/juno/sysidentity.nix b/machines/juno/sysidentity.nix index 5f90eaa..5fd1a76 100644 --- a/machines/juno/sysidentity.nix +++ b/machines/juno/sysidentity.nix @@ -1,11 +1,6 @@ -let - groups = import ../../module-groups.nix; -in -{ +groups: { name = "juno"; arch = "x86_64-linux"; - drop = groups.non-laptop; - #defaultempty = true; - #have = groups.barebones; + include = groups.laptop; } diff --git a/machines/minerva/sysidentity.nix b/machines/minerva/sysidentity.nix index 0afdb49..4e59f68 100644 --- a/machines/minerva/sysidentity.nix +++ b/machines/minerva/sysidentity.nix @@ -1,11 +1,6 @@ -let - groups = import ../../module-groups.nix; -in -{ +groups: { name = "minerva"; arch = "x86_64-linux"; - defaultempty = false; # therefore drop will not remove from have - have = [ "gui-powerful" ]; - drop = groups.non-laptop; + include = groups.laptop ++ [ "gui-powerful" ]; } diff --git a/machines/vesta/sysidentity.nix b/machines/vesta/sysidentity.nix index a689f10..1334d3a 100644 --- a/machines/vesta/sysidentity.nix +++ b/machines/vesta/sysidentity.nix @@ -1,9 +1,6 @@ -let - groups = import ../../module-groups.nix; -in -{ +groups: { name = "vesta"; arch = "x86_64-linux"; - drop = groups.non-desktop; + include = groups.desktop; } diff --git a/module-groups.nix b/module-groups.nix index 9ce1719..dbd00fc 100644 --- a/module-groups.nix +++ b/module-groups.nix @@ -1,6 +1,20 @@ -{ +rec { barebones = [ "cli-essential" "fonts" "users-standard" ]; - non-desktop = [ "battery" "hardware-laptop" "kubernetes" ]; - non-laptop = [ "dev-gui" "gui-powerful" "kubernetes" ]; + personal = barebones ++ [ # default.nix is always included by autoconfig + "hardware-general" "virtualization" + # GUI + "gui-essential" "xserver" "openbox-de" + # Work/development + "cli-powerful" "dev-cli" "tex" "web-server" + # Custom hardware + "keyboards-custom" "rtl-sdr" + ]; + + desktop = personal ++ [ + "dev-gui" "gui-powerful" + ]; + laptop = personal ++ [ + "battery" "hardware-laptop" + ]; } |
