rice/impermanence.nix

86 lines
1.8 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"
"/root/.ssh"
2022-07-22 20:42:05 +00:00
"/srv"
"/var/lib/bluetooth"
"/var/lib/docker"
2022-07-22 20:42:05 +00:00
"/var/lib/machines"
"/var/lib/portables"
2022-07-22 20:42:05 +00:00
"/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 = [
2023-04-03 16:39:26 +00:00
"anki/.local/share/Anki"
"anki/.local/share/Anki2"
"crev/.local/share/crev"
2022-07-22 20:42:05 +00:00
"data/books"
"data/docs"
"data/git"
"data/proj"
"data/reminders"
"data/rice"
"data/uni"
"direnv/.local/share/direnv"
"firefox/.cache/mozilla"
"firefox/.mozilla"
2022-08-22 15:32:51 +00:00
"gpg/.gnupg"
2022-09-13 16:07:45 +00:00
"newsboat/.local/share/newsboat"
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/@old
mv /mnt/@ /mnt/@old
2022-07-22 20:42:05 +00:00
btrfs subvolume create /mnt/@
umount /mnt
echo "done recreating subvolume"
2022-07-22 20:42:05 +00:00
'';
};
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
}