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