31 lines
616 B
Nix
31 lines
616 B
Nix
_:
|
|
|
|
let
|
|
sources = import ../npins;
|
|
|
|
lib = import sources.nix-lib {
|
|
inherit ((import sources.nixpkgs { })) lib;
|
|
|
|
keysRoot = ../keys;
|
|
};
|
|
|
|
meta = import ../meta lib;
|
|
|
|
inherit (lib.extra) getAllKeys;
|
|
in
|
|
|
|
lib.extra
|
|
// rec {
|
|
# Get publickeys associated to a node
|
|
getNodeKeys =
|
|
node:
|
|
let
|
|
names =
|
|
builtins.foldl' (names: group: names ++ meta.organization.groups.${group})
|
|
(meta.nodes.${node}.admins ++ [ "/machines/${node}" ])
|
|
meta.nodes.${node}.adminGroups;
|
|
in
|
|
rootKeys ++ (getAllKeys names);
|
|
|
|
rootKeys = getAllKeys meta.organization.groups.root;
|
|
}
|