rice/impermanence.nix

75 lines
1.5 KiB
Nix
Raw Normal View History

2022-07-22 20:42:05 +00:00
{
config,
lib,
impermanence,
...
}: {
imports = [
"${impermanence}/nixos.nix"
];
2022-08-13 16:06:03 +00:00
# TODO: brightness persistent
2022-07-22 20:42:05 +00:00
environment.persistence."/persist/system" = {
directories = [
"/etc/NetworkManager/system-connections"
"/etc/nixos"
"/srv"
"/var/lib/bluetooth"
"/var/lib/machines"
"/var/log"
];
files = [];
};
programs.fuse.userAllowOther = true; # required for allowOther
home-manager.users.buffet = {
imports = [
"${impermanence}/home-manager.nix"
];
home.persistence."/persist/buffet" = {
removePrefixDirectory = true;
allowOther = true;
directories = [
"chromium/.config/chromium"
2022-07-22 20:42:05 +00:00
"data/books"
"data/docs"
"data/git"
"data/proj"
"data/reminders"
"data/rice"
"data/uni"
2022-08-22 15:32:51 +00:00
"gpg/.gnupg"
2022-07-22 20:42:05 +00:00
"ssh/.ssh"
"trash/.local/share/Trash"
];
files = [
"bash/.bash_history"
];
};
};
fileSystems."/persist".neededForBoot = true;
boot = {
supportedFilesystems = ["btrfs"];
# recreate the root subvolume at boot
initrd.postDeviceCommands = lib.mkBefore ''
echo "recreating root subvolume..."
mkdir -p /mnt
mount ${config.fileSystems."/".device} /mnt
btrfs subvolume delete /mnt/@
btrfs subvolume create /mnt/@
umount /mnt
'';
};
2022-08-22 18:32:26 +00:00
# workaround for agenix running before /etc impermanence gets set up
2022-08-23 20:53:27 +00:00
age.identityPaths = ["/persist/buffet/ssh/.ssh/id_agenix"];
2022-07-22 20:42:05 +00:00
}