Fixed set instead of list error and fixed deprecated option usage.
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted-data-${DISK_NUMBER}";
|
name = "crypted-data-${DISK_NUMBER}";
|
||||||
keyFile = "/run/secrets/disks/data-disk-${DISK_NUMBER}";
|
settings.keyFile = "/run/secrets/disks/data-disk-${DISK_NUMBER}";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "xfs";
|
format = "xfs";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
content = {
|
content = {
|
||||||
type = "luks";
|
type = "luks";
|
||||||
name = "crypted-parity-${DISK_NUMBER}";
|
name = "crypted-parity-${DISK_NUMBER}";
|
||||||
keyFile = "/run/secrets/disks/parity-disk-${DISK_NUMBER}";
|
settings.keyFile = "/run/secrets/disks/parity-disk-${DISK_NUMBER}";
|
||||||
content = {
|
content = {
|
||||||
type = "filesystem";
|
type = "filesystem";
|
||||||
format = "xfs";
|
format = "xfs";
|
||||||
|
|||||||
+10
-9
@@ -1,14 +1,14 @@
|
|||||||
{ modulesPath, config, lib, pkgs, inputs, ... }:
|
{ modulesPath, config, lib, pkgs, inputs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# Create a list of data disk mount points, e.g. [ "/mnt/data-1" "/mnt/data-2" ]
|
# Find all mount points that start with "/mnt/data-"
|
||||||
dataDiskMounts = lib.attrsets.catAttrs "mountpoint" (
|
dataDiskMounts = lib.attrsets.attrNames (
|
||||||
lib.attrsets.filterAttrs (n: v: lib.strings.hasPrefix "data-" n) config.disko.devices.disk
|
lib.attrsets.filterAttrs (name: value: lib.strings.hasPrefix "/mnt/data-" name) config.fileSystems
|
||||||
);
|
);
|
||||||
|
|
||||||
# Create a list of parity disk mount points
|
# Find all mount points that start with "/mnt/parity-"
|
||||||
parityDiskMounts = lib.attrsets.catAttrs "mountpoint" (
|
parityDiskMounts = lib.attrsets.attrNames (
|
||||||
lib.attrsets.filterAttrs (n: v: lib.strings.hasPrefix "parity-" n) config.disko.devices.disk
|
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"; }
|
# 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;
|
enable = true;
|
||||||
contentFiles = map (disk: "${disk}/snapraid.content") dataDiskMounts;
|
contentFiles = map (disk: "${disk}/snapraid.content") dataDiskMounts;
|
||||||
parityFiles = map (disk: "${disk}/snapraid.parity") parityDiskMounts;
|
parityFiles = map (disk: "${disk}/snapraid.parity") parityDiskMounts;
|
||||||
dataDisks = builtins.removeAttrs snapraidDataDisks [ "i" ];
|
dataDisks = builtins.removeAttrs snapraidDataDisks [ "i" ]; # This correctly creates the required attribute set.
|
||||||
# Sync every day at 01:00 am
|
# Using default sync and scrub schedules:
|
||||||
# Scrub every monday at 02:00 am
|
# Sync runs daily at 01:00.
|
||||||
|
# Scrub runs weekly on Monday at 02:00.
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "25.05";
|
system.stateVersion = "25.05";
|
||||||
|
|||||||
Reference in New Issue
Block a user