nixos/swap: allow luks discards if swap discards are enabled

This commit is contained in:
Evgeny Kurnevsky 2021-07-06 10:18:58 +03:00
parent 68d0c4fc9c
commit 11c0384bf0
No known key found for this signature in database
GPG key ID: 8FF444E5412D750C

View file

@ -215,7 +215,7 @@ in
fi
''}
${optionalString sw.randomEncryption.enable ''
cryptsetup plainOpen -c ${sw.randomEncryption.cipher} -d ${sw.randomEncryption.source} ${sw.device} ${sw.deviceName}
cryptsetup plainOpen -c ${sw.randomEncryption.cipher} -d ${sw.randomEncryption.source} ${optionalString (sw.discardPolicy != null) "--allow-discards"} ${sw.device} ${sw.deviceName}
mkswap ${sw.realDevice}
''}
'';