2023-07-24 09:10:34 +02:00
|
|
|
_:
|
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-03-08 11:50:37 +01:00
|
|
|
lib = import sources.nix-lib {
|
|
|
|
inherit ((import sources.nixpkgs { })) lib;
|
2023-10-02 21:48:57 +02:00
|
|
|
|
2024-03-08 11:50:37 +01:00
|
|
|
keysRoot = ../keys;
|
|
|
|
};
|
2024-02-22 09:56:53 +01:00
|
|
|
|
2024-03-08 11:50:37 +01:00
|
|
|
meta = import ../meta lib;
|
|
|
|
|
|
|
|
inherit (lib.extra) getAllKeys;
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
2024-03-08 11:50:37 +01:00
|
|
|
|
|
|
|
lib.extra
|
2024-02-22 09:56:53 +01:00
|
|
|
// rec {
|
2023-10-02 21:48:57 +02:00
|
|
|
# Get publickeys associated to a node
|
2024-02-02 10:51:31 +01:00
|
|
|
getNodeKeys =
|
|
|
|
node:
|
2023-10-02 21:48:57 +02:00
|
|
|
let
|
|
|
|
names =
|
2024-03-08 11:50:37 +01:00
|
|
|
builtins.foldl' (names: group: names ++ meta.organization.groups.${group})
|
2024-02-02 10:51:31 +01:00
|
|
|
(meta.nodes.${node}.admins ++ [ "/machines/${node}" ])
|
2024-02-22 09:56:53 +01:00
|
|
|
meta.nodes.${node}.adminGroups;
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
2024-03-08 11:50:37 +01:00
|
|
|
rootKeys ++ (getAllKeys names);
|
2024-02-22 09:56:53 +01:00
|
|
|
|
2024-03-08 11:50:37 +01:00
|
|
|
rootKeys = getAllKeys meta.organization.groups.root;
|
2024-03-08 23:11:10 +01:00
|
|
|
|
|
|
|
machineKeys =
|
|
|
|
rootKeys ++ (getAllKeys (builtins.map (n: "machines/${n}") (builtins.attrNames meta.nodes)));
|
2024-02-22 09:56:53 +01:00
|
|
|
}
|