1
Fork 0
satellite/hosts/nixos/common/users/common.nix

22 lines
536 B
Nix
Raw Normal View History

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
idKey = host: ../../${host}/id_ed25519.pub;
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)
];
}