about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMikaela Allan <me@mikaela.ca>2023-05-07 11:42:36 -0400
committerMikaela Allan <me@mikaela.ca>2023-05-07 11:42:36 -0400
commit445d7cae2aebeabe4f9ba6ecd2f2177ac1be4bcb (patch)
tree73d13dc5701d3068111aa4e596fed376deb1007c
parent21b6bec0ff14f55c37a655529d6ad2e81f1c4212 (diff)
nixos/config/swap: refactor startup script generation
-rw-r--r--nixos/modules/config/swap.nix12
1 files changed, 6 insertions, 6 deletions
diff --git a/nixos/modules/config/swap.nix b/nixos/modules/config/swap.nix
index 1b63741e86c4a..5c812a9226e84 100644
--- a/nixos/modules/config/swap.nix
+++ b/nixos/modules/config/swap.nix
@@ -275,12 +275,12 @@ in
                 ''}
                 ${optionalString sw.randomEncryption.enable ''
                   cryptsetup plainOpen -c ${sw.randomEncryption.cipher} -d ${sw.randomEncryption.source} \
-                '' + concatLines (filter (s: s != "") [
-                    (optionalString (sw.randomEncryption.sectorSize != null) "--sector-size=${toString sw.randomEncryption.sectorSize} \\")
-                    (optionalString (sw.randomEncryption.keySize != null) "--key-size=${toString sw.randomEncryption.keySize} \\")
-                    (optionalString sw.randomEncryption.allowDiscards "--allow-discards \\")
-                  ]) + ''
-                    ${sw.device} ${sw.deviceName}
+                '' + concatMapStrings (arg: arg + " \\\n") (flatten [
+                  (optional (sw.randomEncryption.sectorSize != null) "--sector-size=${toString sw.randomEncryption.sectorSize}")
+                  (optional (sw.randomEncryption.keySize != null) "--key-size=${toString sw.randomEncryption.keySize}")
+                  (optional sw.randomEncryption.allowDiscards "--allow-discards")
+                ]) + ''
+                  ${sw.device} ${sw.deviceName}
                   mkswap ${sw.realDevice}
                 ''}
               '';