feat(nixos): move persist options to system and users modules

This commit is contained in:
Mohammad Rafiq 2025-07-07 14:15:33 +08:00
parent a6fdc1b6e6
commit 36b459475a
No known key found for this signature in database
3 changed files with 4 additions and 6 deletions

View file

@ -18,18 +18,12 @@ in
fi fi
''; '';
persistFiles = [ persistFiles = [
#TODO: move to system config
"/etc/machine-id"
#TODO: move to ssh config #TODO: move to ssh config
"/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub" "/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key" "/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub" "/etc/ssh/ssh_host_rsa_key.pub"
]; ];
persistDirs = [
"/var/lib/systemd"
"/var/lib/nixos"
];
}) })
]; ];
}; };

View file

@ -1,5 +1,7 @@
{ {
flake.modules.nixos.default = { flake.modules.nixos.default = {
persistFiles = [ "/etc/machine-id" ];
persistDirs = [ "/var/lib/systemd" ];
system.stateVersion = "25.11"; system.stateVersion = "25.11";
}; };
flake.modules.homeManager.default = flake.modules.homeManager.default =

View file

@ -13,6 +13,8 @@ in
# nix.settings.trusted-users = [ "@wheel" ]; # nix.settings.trusted-users = [ "@wheel" ];
#TODO: move ssh key settings elsewhere #TODO: move ssh key settings elsewhere
# users.users.root.openssh.authorizedKeys.keys = [ owner.pubkey ]; # users.users.root.openssh.authorizedKeys.keys = [ owner.pubkey ];
# persist uids and gids
persistDirs = [ "/var/lib/nixos" ];
users = { users = {
mutableUsers = false; mutableUsers = false;
groups.users.gid = 100; groups.users.gid = 100;