infrastructure/lib/default.nix

30 lines
586 B
Nix
Raw Normal View History

_:
2023-05-22 15:05:20 +02:00
let
2023-07-23 22:16:59 +02:00
sources = import ../npins;
2023-05-22 15:05:20 +02:00
2024-02-22 09:56:53 +01:00
lib =
(import sources.nix-lib {
inherit ((import sources.nixpkgs { })) lib;
keysRoot = ../keys;
}).extra;
2024-02-22 09:56:53 +01:00
meta = import ../meta;
in
2024-02-22 09:56:53 +01:00
lib
// rec {
# Get publickeys associated to a node
getNodeKeys =
node:
let
names =
builtins.foldl' (names: group: names ++ meta.members.groups.${group})
(meta.nodes.${node}.admins ++ [ "/machines/${node}" ])
2024-02-22 09:56:53 +01:00
meta.nodes.${node}.adminGroups;
in
2024-02-22 09:56:53 +01:00
rootKeys ++ (lib.getAllKeys names);
rootKeys = lib.getAllKeys meta.members.groups.root;
}