2023-05-28 05:24:36 +02:00
|
|
|
{
|
|
|
|
authorizedKeys = { outputs, lib }:
|
|
|
|
let
|
|
|
|
# Record containing all the hosts
|
|
|
|
hosts = outputs.nixosConfigurations;
|
|
|
|
|
|
|
|
# Function from hostname to relative path to public ssh key
|
2023-08-17 09:31:46 +02:00
|
|
|
idKey = host: ../../${host}/keys/id_ed25519.pub;
|
2023-05-28 05:24:36 +02:00
|
|
|
in
|
|
|
|
lib.pipe hosts [
|
|
|
|
# attrsetof host -> attrsetof path
|
|
|
|
(builtins.mapAttrs
|
|
|
|
(name: _: idKey name)) # string -> host -> path
|
|
|
|
|
|
|
|
# attrsetof path -> path[]
|
|
|
|
builtins.attrValues
|
|
|
|
|
|
|
|
# path[] -> path[]
|
|
|
|
(builtins.filter builtins.pathExists)
|
|
|
|
];
|
|
|
|
}
|