diff --git a/lib/devos/default.nix b/lib/devos/default.nix index bf109ba..ce48824 100644 --- a/lib/devos/default.nix +++ b/lib/devos/default.nix @@ -11,6 +11,8 @@ mkNodes = dev.callLibs ./mkNodes.nix; + mkSuites = dev.callLibs ./mkSuites.nix; + mkProfileAttrs = dev.callLibs ./mkProfileAttrs.nix; mkPkgs = dev.callLibs ./mkPkgs.nix; diff --git a/lib/devos/mkSuites.nix b/lib/devos/mkSuites.nix new file mode 100644 index 0000000..a3a3294 --- /dev/null +++ b/lib/devos/mkSuites.nix @@ -0,0 +1,24 @@ +{ lib, dev, ... }: + +{ users, profiles, userProfiles, suites } @ args: +let + inherit (dev) os; + + definedSuites = suites { + inherit (args) users profiles userProfiles; + }; + + allProfiles = + let defaults = lib.collect (x: x ? default) profiles; + in map (x: x.default) defaults; + + allUsers = + let defaults = lib.collect (x: x ? default) users; + in map (x: x.default) defaults; + + createSuites = _: suites: lib.mapAttrs (_: v: os.profileMap v) suites // { + inherit allProfiles allUsers; + }; + +in +lib.mapAttrs createSuites definedSuites diff --git a/suites/default.nix b/suites/default.nix index e1b7d66..4a65b55 100644 --- a/suites/default.nix +++ b/suites/default.nix @@ -1,35 +1,10 @@ -{ lib }: -let - inherit (lib) dev; +{ users, profiles, userProfiles, ... }: - profiles = dev.os.mkProfileAttrs (toString ../profiles); - userProfiles = dev.os.mkProfileAttrs (toString ../users/profiles); - users = dev.os.mkProfileAttrs (toString ../users); - - allProfiles = - let defaults = lib.collect (x: x ? default) profiles; - in map (x: x.default) defaults; - - allUsers = - let defaults = lib.collect (x: x ? default) users; - in map (x: x.default) defaults; - - - suites = with profiles; rec { +{ + system = with profiles; rec { base = [ users.nixos users.root ]; }; - - # available as 'suites' within the home-manager configuration - userSuites = with userProfiles; rec { + user = with userProfiles; rec { base = [ direnv git ]; }; - -in -{ - system = lib.mapAttrs (_: v: dev.os.profileMap v) suites // { - inherit allProfiles allUsers; - }; - user = lib.mapAttrs (_: v: dev.os.profileMap v) userSuites // { - allProfiles = userProfiles; - }; }