nixos/config/swap: refactor startup script generation
This commit is contained in:
parent
21b6bec0ff
commit
445d7cae2a
@ -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}
|
||||
''}
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user