feat(lib): Separate rootKeys

This commit is contained in:
Tom Hubrecht 2024-02-22 09:56:53 +01:00
parent c5aebedd7b
commit 396cb86c4d

View file

@ -3,24 +3,27 @@ _:
let let
sources = import ../npins; sources = import ../npins;
nix-lib = lib =
(import sources.nix-lib { (import sources.nix-lib {
inherit ((import sources.nixpkgs { })) lib; inherit ((import sources.nixpkgs { })) lib;
keysRoot = ../keys; keysRoot = ../keys;
}).extra; }).extra;
meta = import ../meta;
in in
nix-lib lib
// (with nix-lib; { // rec {
# Get publickeys associated to a node # Get publickeys associated to a node
getNodeKeys = getNodeKeys =
node: node:
let let
meta = import ../meta;
names = names =
builtins.foldl' (names: group: names ++ meta.members.groups.${group}) builtins.foldl' (names: group: names ++ meta.members.groups.${group})
(meta.nodes.${node}.admins ++ [ "/machines/${node}" ]) (meta.nodes.${node}.admins ++ [ "/machines/${node}" ])
(meta.nodes.${node}.adminGroups ++ [ "root" ]); meta.nodes.${node}.adminGroups;
in in
getAllKeys names; rootKeys ++ (lib.getAllKeys names);
})
rootKeys = lib.getAllKeys meta.members.groups.root;
}