enable impermanence for hopper
This commit is contained in:
parent
7be2e59a92
commit
e192a50071
33 changed files with 155 additions and 111 deletions
|
@ -11,11 +11,13 @@
|
|||
inputs.hardware.nixosModules.common-cpu-intel
|
||||
inputs.vpn-confinement.nixosModules.default
|
||||
inputs.nix-minecraft.nixosModules.minecraft-servers
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
|
||||
./hardware.nix
|
||||
./lab
|
||||
./roblox-playtime.nix
|
||||
./desktop.nix
|
||||
./persistent.nix
|
||||
|
||||
{
|
||||
home-manager = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{config, ...}: {
|
||||
{lib, ...}: {
|
||||
nixpkgs.hostPlatform.system = "x86_64-linux";
|
||||
|
||||
## nvidia gpu
|
||||
|
@ -37,6 +37,31 @@
|
|||
};
|
||||
};
|
||||
|
||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount /dev/disk/by-uuid/1297e638-f2ff-49a2-a362-314ac7eeaabc /btrfs_tmp
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
IFS=$'\n'
|
||||
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
|
||||
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||
done
|
||||
btrfs subvolume delete "$1"
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-uuid/1297e638-f2ff-49a2-a362-314ac7eeaabc";
|
||||
|
@ -53,6 +78,12 @@
|
|||
fsType = "btrfs";
|
||||
options = ["subvol=nix" "compress=zstd" "noatime"];
|
||||
};
|
||||
"/persist" = {
|
||||
device = "/dev/disk/by-uuid/1297e638-f2ff-49a2-a362-314ac7eeaabc";
|
||||
neededForBoot = true;
|
||||
fsType = "btrfs";
|
||||
options = ["subvol=persist" "compress=zstd"];
|
||||
};
|
||||
"/boot" = {
|
||||
device = "/dev/disk/by-uuid/8D4C-2F05";
|
||||
fsType = "vfat";
|
||||
|
|
|
@ -23,4 +23,6 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/acme"];
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"tls://unfiltered.adguard-dns.com"
|
||||
"https://dns10.quad9.net/dns-query"
|
||||
];
|
||||
bind_hosts = ["100.115.105.144"];
|
||||
bind_hosts = [vars.tailnet.hopper];
|
||||
bootstrap_dns = ["1.1.1.1" "8.8.8.8"];
|
||||
};
|
||||
filtering = {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
host = "0.0.0.0";
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/${config.services.audiobookshelf.dataDir}"];
|
||||
services.restic.backups.hopper.paths = [
|
||||
"/var/lib/${config.services.audiobookshelf.dataDir}"
|
||||
];
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
services.jellyfin.enable = true;
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/jellyfin"];
|
||||
services.restic.backups.hopper.paths = [
|
||||
"/var/lib/jellyfin/data"
|
||||
"/var/lib/jellyfin/config"
|
||||
|
|
|
@ -45,5 +45,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/srv/minecraft"];
|
||||
services.restic.backups.hopper.paths = ["/srv/minecraft"];
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
};
|
||||
systemd.services.navidrome.serviceConfig.EnvironmentFile = config.sops.secrets.navidrome.path;
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/navidrome"];
|
||||
|
||||
services.restic.backups.hopper = {
|
||||
paths = ["/var/lib/navidrome"];
|
||||
exclude = ["/var/lib/navidrome/cache"];
|
||||
|
|
|
@ -48,5 +48,6 @@
|
|||
systemd.enable = true;
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/prometheus2"];
|
||||
services.restic.backups.hopper.paths = ["/var/lib/prometheus2"];
|
||||
}
|
||||
|
|
|
@ -63,5 +63,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/srv/vault"];
|
||||
services.restic.backups.hopper.paths = ["/srv/vault"];
|
||||
}
|
||||
|
|
|
@ -36,4 +36,6 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/slskd"];
|
||||
}
|
||||
|
|
|
@ -28,4 +28,6 @@
|
|||
};
|
||||
# credentialsFile = config.sops.secrets.transmission.path;
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/transmission"];
|
||||
}
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/bitwarden_rs"];
|
||||
services.restic.backups.hopper.paths = ["/var/lib/bitwarden_rs"];
|
||||
}
|
||||
|
|
18
sys/machines/hopper/persistent.nix
Normal file
18
sys/machines/hopper/persistent.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
"/home/desktop"
|
||||
"/home/deploy"
|
||||
"/media"
|
||||
"/var/log"
|
||||
"/var/lib/nixos"
|
||||
"/var/lib/bluetooth"
|
||||
];
|
||||
files = [
|
||||
"/etc/machine-id"
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
"/etc/ssh/ssh_host_ed25519_key.pub"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -10,5 +10,6 @@
|
|||
configFile = config.sops.secrets.roblox-playtime.path;
|
||||
};
|
||||
|
||||
environment.persistence."/persist".directories = ["/var/lib/roblox-playtime"];
|
||||
services.restic.backups.hopper.paths = ["/var/lib/roblox-playtime"];
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
./restic-server.nix
|
||||
./autologin.nix
|
||||
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.stylix.nixosModules.stylix
|
||||
|
||||
{
|
||||
|
@ -126,6 +127,8 @@
|
|||
android_sdk.accept_license = true;
|
||||
};
|
||||
|
||||
environment.persistence."/persist".enable = false;
|
||||
|
||||
networking.interfaces.eno1.wakeOnLan.enable = true;
|
||||
|
||||
system.stateVersion = "23.11";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue