refactor(nixos/ssh): add authorizedKeys to ssh module & rm from users
This commit is contained in:
parent
b63959f307
commit
bf260096d5
2 changed files with 18 additions and 11 deletions
|
@ -1,10 +1,20 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.flake;
|
||||
inherit (lib.modules) mkMerge;
|
||||
inherit (cfg.lib.modules) forAllUsers';
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.default = {
|
||||
persistFiles = [
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||
"/etc/ssh/ssh_host_rsa_key"
|
||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||
];
|
||||
};
|
||||
flake.modules.nixos.default = mkMerge [
|
||||
{
|
||||
persistFiles = [
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||
"/etc/ssh/ssh_host_rsa_key"
|
||||
"/etc/ssh/ssh_host_rsa_key.pub"
|
||||
];
|
||||
users.users = forAllUsers' (_: value: { openssh.authorizedKeys.keys = [ value.pubkey ]; });
|
||||
}
|
||||
{ users.users.root.openssh.authorizedKeys.keys = [ cfg.admin.pubkey ]; }
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue