From 93bc56aa05564cafb3da8252d7d318d04a5067e3 Mon Sep 17 00:00:00 2001 From: sajenim Date: Sun, 14 Jan 2024 06:29:32 +0800 Subject: [PATCH] persist --- home-manager/sajenim/home.nix | 28 ++++++++++++++++++++++++++++ nixos/common/optional/persist.nix | 22 ++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 nixos/common/optional/persist.nix diff --git a/home-manager/sajenim/home.nix b/home-manager/sajenim/home.nix index 66fe6cb..c16e75a 100644 --- a/home-manager/sajenim/home.nix +++ b/home-manager/sajenim/home.nix @@ -89,6 +89,34 @@ # Unstable user programs unstable.wezterm ]; + + persistence."/persist/home/sajenim" = { + directories = [ + "Documents" + "Downloads" + "Games" + "Music" + "Pictures" + "Printer" + "Videos" + + ".gnupg" + ".ssh" + ".github" + ".mozilla" + ".zsh_history" + + ".local/bin" + ".local/share/nix" + ".local/share/nvim" + + ".config/discord" + ".config/BetterDiscord" + ".config/PrusaSlicer" + ".config/Yubico" + ]; + allowOther = true; + }; }; # Setup our window manager diff --git a/nixos/common/optional/persist.nix b/nixos/common/optional/persist.nix new file mode 100644 index 0000000..26d3b1b --- /dev/null +++ b/nixos/common/optional/persist.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + # Files and directories we with to keep between reboots + environment.persistence."/persist" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + ]; + }; +}