2025-11-10 14:16:07 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
let
|
|
|
|
|
excludes = [
|
|
|
|
|
"/media/usenet/incomplete/"
|
|
|
|
|
"/.snapshot/"
|
|
|
|
|
];
|
|
|
|
|
snapshot-path = [
|
|
|
|
|
pkgs.bash
|
|
|
|
|
pkgs.btrfs-progs
|
|
|
|
|
];
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
#systemd.timers."snapraid-sync".enable = false; #temporarily
|
|
|
|
|
#systemd.timers."snapraid-scrub".enable = false; #temporarily
|
|
|
|
|
|
|
|
|
|
systemd.services."snapraid-sync" = {
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
ReadWritePaths = [
|
|
|
|
|
"/mnt/snapshot/ZVV0688G/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/ZVV072JR/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/ZXA0FSKT/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/X2N0A0AZFJDH/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/53G0A2AXFJDH/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/92F0A079FJDH/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/X2N0A0AXFJDH/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/43P0A00FFJDH/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/ZA1D9307/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/1EJZN6MZ/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/1EKR513Z/.snapshot/"
|
|
|
|
|
"/mnt/snapshot/1EKVK21Z/.snapshot/"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
unitConfig.After = "snapraid-pre.service";
|
|
|
|
|
unitConfig.Before = "snapraid-post.service";
|
|
|
|
|
wants = [
|
|
|
|
|
"snapraid-pre.service"
|
|
|
|
|
"snapraid-post.service"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
systemd.services = {
|
|
|
|
|
snapraid-pre = {
|
|
|
|
|
description = "Create btrfs snapshots for each disk in the array";
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "oneshot";
|
2025-11-10 14:17:36 +01:00
|
|
|
ExecStart = "/etc/nixos/scripts/snapraid_snapshots.sh create";
|
2025-11-10 14:16:07 +01:00
|
|
|
};
|
|
|
|
|
path = snapshot-path;
|
|
|
|
|
};
|
|
|
|
|
snapraid-post = {
|
|
|
|
|
description = "Delete btrfs snapshots for each disk in the array";
|
|
|
|
|
serviceConfig = {
|
|
|
|
|
Type = "oneshot";
|
2025-11-10 14:17:36 +01:00
|
|
|
ExecStart = "/etc/nixos/scripts/snapraid_snapshots.sh delete";
|
2025-11-10 14:16:07 +01:00
|
|
|
};
|
|
|
|
|
path = snapshot-path;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.snapraid = {
|
|
|
|
|
enable = true;
|
|
|
|
|
scrub.plan = 5;
|
|
|
|
|
touchBeforeSync = false; # doesn't work with snapshots
|
|
|
|
|
parityFiles = [
|
|
|
|
|
"/mnt/drives/43P0A00AFJDH/snapraid1.parity"
|
|
|
|
|
"/mnt/drives/ZXA0MNRB/snapraid2.parity"
|
|
|
|
|
];
|
|
|
|
|
dataDisks = {
|
|
|
|
|
d1 = "/mnt/snapshot/ZVV0688G/";
|
|
|
|
|
d2 = "/mnt/snapshot/ZVV072JR/";
|
|
|
|
|
d3 = "/mnt/snapshot/ZXA0FSKT/";
|
|
|
|
|
d4 = "/mnt/snapshot/X2N0A0AZFJDH/";
|
|
|
|
|
d5 = "/mnt/snapshot/53G0A2AXFJDH/";
|
|
|
|
|
d6 = "/mnt/snapshot/92F0A079FJDH/";
|
|
|
|
|
d7 = "/mnt/snapshot/X2N0A0AXFJDH/";
|
|
|
|
|
d8 = "/mnt/snapshot/43P0A00FFJDH/";
|
|
|
|
|
d9 = "/mnt/snapshot/ZA1D9307/";
|
|
|
|
|
d10 = "/mnt/snapshot/1EJZN6MZ/";
|
|
|
|
|
d11 = "/mnt/snapshot/1EKR513Z/";
|
|
|
|
|
d12 = "/mnt/snapshot/1EKVK21Z/";
|
|
|
|
|
};
|
|
|
|
|
contentFiles = [
|
|
|
|
|
"/mnt/snapraid1.content"
|
|
|
|
|
"/mnt/drives/43P0A00AFJDH/snapraid2.content"
|
|
|
|
|
"/mnt/drives/ZXA0MNRB/snapraid3.content"
|
|
|
|
|
];
|
|
|
|
|
exclude = excludes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#imports = [ ./modules/snapraid.nix ];
|
|
|
|
|
|
|
|
|
|
#services.snapraidnew = {
|
|
|
|
|
# "8tb" = {
|
|
|
|
|
# arrayName = "8tb";
|
|
|
|
|
# enable = true;
|
|
|
|
|
# scrub.plan = 5;
|
|
|
|
|
# parityFiles = [
|
|
|
|
|
# "/mnt/drives/ZA1D9307/snapraid-8tb.parity"
|
|
|
|
|
# ];
|
|
|
|
|
# dataDisks = {
|
|
|
|
|
# d1 = "/mnt/drives/1EJZN6MZ";
|
|
|
|
|
# d2 = "/mnt/drives/1EKR513Z";
|
|
|
|
|
# d3 = "/mnt/drives/1EKVK21Z";
|
|
|
|
|
# };
|
|
|
|
|
# contentFiles = [
|
|
|
|
|
# "/mnt/snapraid-8tb1.content"
|
|
|
|
|
# "/mnt/drives/X2N0A0AZFJDH/snapraid-8tb2.content"
|
|
|
|
|
# ];
|
|
|
|
|
# exclude = excludes;
|
|
|
|
|
# };
|
|
|
|
|
# "18tb" = {
|
|
|
|
|
# enable = true;
|
|
|
|
|
# scrub.plan = 5;
|
|
|
|
|
# parityFiles = [
|
|
|
|
|
# "/mnt/drives/X2N0A0AZFJDH/snapraid.parity"
|
|
|
|
|
# ];
|
|
|
|
|
# dataDisks = {
|
|
|
|
|
# d1 = "/mnt/drives/43P0A00AFJDH";
|
|
|
|
|
# d2 = "/mnt/drives/43P0A00FFJDH";
|
|
|
|
|
# d3 = "/mnt/drives/92F0A079FJDH";
|
|
|
|
|
# d4 = "/mnt/drives/X2N0A0AXFJDH";
|
|
|
|
|
# d5 = "/mnt/drives/53J0A016FJDH";
|
|
|
|
|
# d6 = "/mnt/drives/ZVV072JR";
|
|
|
|
|
# d7 = "/mnt/drives/ZVV0688G";
|
|
|
|
|
# };
|
|
|
|
|
# contentFiles = [
|
|
|
|
|
# "/mnt/snapraid-18tb1.content"
|
|
|
|
|
# "/mnt/drives/ZA1D9307/snapraid-18tb2.content"
|
|
|
|
|
# ];
|
|
|
|
|
# exclude = excludes;
|
|
|
|
|
# };
|
|
|
|
|
#};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
# vim: set et ts=2 sw=2 ai:
|