move suites implementation logic to lib as mkSuites
This commit is contained in:
parent
8ab865a853
commit
7ebd6b5730
3 changed files with 30 additions and 29 deletions
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
mkNodes = dev.callLibs ./mkNodes.nix;
|
mkNodes = dev.callLibs ./mkNodes.nix;
|
||||||
|
|
||||||
|
mkSuites = dev.callLibs ./mkSuites.nix;
|
||||||
|
|
||||||
mkProfileAttrs = dev.callLibs ./mkProfileAttrs.nix;
|
mkProfileAttrs = dev.callLibs ./mkProfileAttrs.nix;
|
||||||
|
|
||||||
mkPkgs = dev.callLibs ./mkPkgs.nix;
|
mkPkgs = dev.callLibs ./mkPkgs.nix;
|
||||||
|
|
24
lib/devos/mkSuites.nix
Normal file
24
lib/devos/mkSuites.nix
Normal file
|
@ -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
|
|
@ -1,35 +1,10 @@
|
||||||
{ lib }:
|
{ users, profiles, userProfiles, ... }:
|
||||||
let
|
|
||||||
inherit (lib) dev;
|
|
||||||
|
|
||||||
profiles = dev.os.mkProfileAttrs (toString ../profiles);
|
{
|
||||||
userProfiles = dev.os.mkProfileAttrs (toString ../users/profiles);
|
system = with profiles; rec {
|
||||||
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 {
|
|
||||||
base = [ users.nixos users.root ];
|
base = [ users.nixos users.root ];
|
||||||
};
|
};
|
||||||
|
user = with userProfiles; rec {
|
||||||
# available as 'suites' within the home-manager configuration
|
|
||||||
userSuites = with userProfiles; rec {
|
|
||||||
base = [ direnv git ];
|
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;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue