try preservation
This commit is contained in:
parent
438f48ebf0
commit
e9b8c54312
3 changed files with 87 additions and 3 deletions
77
hosts/i001/preservation.nix
Normal file
77
hosts/i001/preservation.nix
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
{ ... }:
|
||||
{
|
||||
preservation = {
|
||||
enable = true;
|
||||
|
||||
# Preserve system-wide directories and files at /persist
|
||||
preserveAt = {
|
||||
"/persist" = {
|
||||
hideMounts = true;
|
||||
|
||||
# Directories to persist (bind-mount by default)
|
||||
directories = [
|
||||
"/var/log"
|
||||
"/var/lib/nixos"
|
||||
"/var/lib/systemd/coredump"
|
||||
"/var/lib/systemd/timers"
|
||||
|
||||
"/etc/nixos"
|
||||
"/etc/ssh"
|
||||
|
||||
"/etc/NetworkManager/system-connections"
|
||||
"/var/lib/bluetooth"
|
||||
"/var/lib/NetworkManager"
|
||||
"/var/lib/iwd"
|
||||
"/var/lib/fail2ban"
|
||||
];
|
||||
|
||||
# Files to persist
|
||||
files = [
|
||||
# Persist machine-id early (initrd)
|
||||
{ file = "/etc/machine-id"; inInitrd = true; }
|
||||
|
||||
# SSH host keys: ensure correct handling with symlinks
|
||||
{ file = "/etc/ssh/ssh_host_rsa_key"; how = "symlink"; configureParent = true; }
|
||||
{ file = "/etc/ssh/ssh_host_ed25519_key"; how = "symlink"; configureParent = true; }
|
||||
];
|
||||
|
||||
# Per-user persistence
|
||||
users = {
|
||||
luser = {
|
||||
directories = [
|
||||
".ssh"
|
||||
".gnupg"
|
||||
|
||||
"projects"
|
||||
".config/nixos-config"
|
||||
|
||||
".config/atuin"
|
||||
".local/share/atuin"
|
||||
|
||||
".local/share/zoxide"
|
||||
|
||||
# KDE
|
||||
".config/kdeconnect"
|
||||
|
||||
# Chrome
|
||||
".config/google-chrome"
|
||||
|
||||
# neovim ros_neovim
|
||||
".local/state/nvim_ringofstorms_helium"
|
||||
];
|
||||
files = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Configure intermediate system-wide directories that may need custom modes
|
||||
# (Example: none required beyond defaults here.)
|
||||
|
||||
# If you need custom ownership/modes for parent directories, use tmpfiles:
|
||||
# systemd.tmpfiles.settings.preservation = {
|
||||
# "/foo".d = { user = "foo"; group = "bar"; mode = "0775"; };
|
||||
# "/foo/bar".d = { user = "bar"; group = "bar"; mode = "0755"; };
|
||||
# };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue