suites: mv to dir

This commit is contained in:
Timothy DeHerrera 2021-02-06 01:31:48 -07:00
parent c6d25002ed
commit 1d5b489bb2
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
4 changed files with 26 additions and 25 deletions

2
DOC.md
View file

@ -32,7 +32,7 @@ explicitly loaded via `imports`.
## Suites ## Suites
[Suites](./profiles/suites.nix) are simple collections of profiles that can be [Suites](./suites/default.nix) are simple collections of profiles that can be
directly imported from any host like so: directly imported from any host like so:
``` ```
{ suites, ... }: { suites, ... }:

View file

@ -12,8 +12,7 @@ let
inherit (lib.flk) recImport nixosSystemExtended defaultImports; inherit (lib.flk) recImport nixosSystemExtended defaultImports;
inherit (builtins) attrValues removeAttrs; inherit (builtins) attrValues removeAttrs;
profiles = defaultImports (toString ../profiles); suites = import ../suites { inherit lib profiles; };
suites = import ../profiles/suites.nix { inherit lib profiles; };
config = hostName: config = hostName:
nixosSystemExtended { nixosSystemExtended {

View file

@ -1,22 +0,0 @@
{ lib, profiles }:
let
inherit (builtins) mapAttrs isFunction;
allProfiles =
let
filtered = lib.filterAttrs (n: _: n != "core") profiles;
in
lib.collect isFunction filtered;
allUsers = lib.collect isFunction users;
users = lib.flk.defaultImports (toString ../users);
in
with profiles;
mapAttrs (_: v: lib.flk.profileMap v)
# define your own suites below
rec {
core = [ users.nixos users.root ];
} // {
inherit allProfiles allUsers;
}

24
suites/default.nix Normal file
View file

@ -0,0 +1,24 @@
{ lib }:
let
inherit (builtins) mapAttrs isFunction;
inherit (lib.flk) importDefaults;
profiles = importDefaults (toString ../profiles);
users = importDefaults (toString ../users);
allProfiles =
let
sansCore = lib.filterAttrs (n: _: n != "core") profiles;
in
lib.collect isFunction sansCore;
allUsers = lib.collect isFunction users;
suites = with profiles; rec {
core = [ users.nixos users.root ];
};
in
mapAttrs (_: v: lib.flk.profileMap v) suites // {
inherit allProfiles allUsers;
}