From 1d5b489bb299e739552d625e7171f2fe75078d80 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Sat, 6 Feb 2021 01:31:48 -0700 Subject: [PATCH] suites: mv to dir --- DOC.md | 2 +- hosts/default.nix | 3 +-- profiles/suites.nix | 22 ---------------------- suites/default.nix | 24 ++++++++++++++++++++++++ 4 files changed, 26 insertions(+), 25 deletions(-) delete mode 100644 profiles/suites.nix create mode 100644 suites/default.nix diff --git a/DOC.md b/DOC.md index d3838388..e5c0a7aa 100644 --- a/DOC.md +++ b/DOC.md @@ -32,7 +32,7 @@ explicitly loaded via `imports`. ## 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: ``` { suites, ... }: diff --git a/hosts/default.nix b/hosts/default.nix index a91b061d..0a6979e7 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -12,8 +12,7 @@ let inherit (lib.flk) recImport nixosSystemExtended defaultImports; inherit (builtins) attrValues removeAttrs; - profiles = defaultImports (toString ../profiles); - suites = import ../profiles/suites.nix { inherit lib profiles; }; + suites = import ../suites { inherit lib profiles; }; config = hostName: nixosSystemExtended { diff --git a/profiles/suites.nix b/profiles/suites.nix deleted file mode 100644 index 44adab1b..00000000 --- a/profiles/suites.nix +++ /dev/null @@ -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; -} diff --git a/suites/default.nix b/suites/default.nix new file mode 100644 index 00000000..016e8e37 --- /dev/null +++ b/suites/default.nix @@ -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; +}