Fixed set instead of list error and fixed deprecated option usage.

This commit is contained in:
Raphaël Billet
2025-11-27 10:37:02 +01:00
parent 855543beda
commit 76bf33ce78
3 changed files with 12 additions and 11 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
content = {
type = "luks";
name = "crypted-data-${DISK_NUMBER}";
keyFile = "/run/secrets/disks/data-disk-${DISK_NUMBER}";
settings.keyFile = "/run/secrets/disks/data-disk-${DISK_NUMBER}";
content = {
type = "filesystem";
format = "xfs";
+1 -1
View File
@@ -9,7 +9,7 @@
content = {
type = "luks";
name = "crypted-parity-${DISK_NUMBER}";
keyFile = "/run/secrets/disks/parity-disk-${DISK_NUMBER}";
settings.keyFile = "/run/secrets/disks/parity-disk-${DISK_NUMBER}";
content = {
type = "filesystem";
format = "xfs";
+10 -9
View File
@@ -1,14 +1,14 @@
{ modulesPath, config, lib, pkgs, inputs, ... }:
let
# Create a list of data disk mount points, e.g. [ "/mnt/data-1" "/mnt/data-2" ]
dataDiskMounts = lib.attrsets.catAttrs "mountpoint" (
lib.attrsets.filterAttrs (n: v: lib.strings.hasPrefix "data-" n) config.disko.devices.disk
# Find all mount points that start with "/mnt/data-"
dataDiskMounts = lib.attrsets.attrNames (
lib.attrsets.filterAttrs (name: value: lib.strings.hasPrefix "/mnt/data-" name) config.fileSystems
);
# Create a list of parity disk mount points
parityDiskMounts = lib.attrsets.catAttrs "mountpoint" (
lib.attrsets.filterAttrs (n: v: lib.strings.hasPrefix "parity-" n) config.disko.devices.disk
# Find all mount points that start with "/mnt/parity-"
parityDiskMounts = lib.attrsets.attrNames (
lib.attrsets.filterAttrs (name: value: lib.strings.hasPrefix "/mnt/parity-" name) config.fileSystems
);
# Create an attribute set for snapraid data disks, e.g. { d1 = "/mnt/data-1"; d2 = "/mnt/data-2"; }
@@ -202,9 +202,10 @@ in
enable = true;
contentFiles = map (disk: "${disk}/snapraid.content") dataDiskMounts;
parityFiles = map (disk: "${disk}/snapraid.parity") parityDiskMounts;
dataDisks = builtins.removeAttrs snapraidDataDisks [ "i" ];
# Sync every day at 01:00 am
# Scrub every monday at 02:00 am
dataDisks = builtins.removeAttrs snapraidDataDisks [ "i" ]; # This correctly creates the required attribute set.
# Using default sync and scrub schedules:
# Sync runs daily at 01:00.
# Scrub runs weekly on Monday at 02:00.
};
system.stateVersion = "25.05";