git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/swap: add randomEncryption.allowDiscards option
commit8a3a429da6c149c743498b41e2bd6a36f6963d65 authorbb2020 <bb2020@users.noreply.github.com> dateFri 23 Jul 2021, 23:06 (5 years ago) parent356d28d
1 file changed+11−1
nixos/modules/config/swap.nix+11−1
nixos/modules/config/swap.nix+11−1
@@ -47,6 +47,15 @@ let
4747 '';
4848 };
4949
50+ allowDiscards = mkOption {
51+ default = false;
52+ type = types.bool;
53+ description = ''
54+ Whether to allow TRIM requests to the underlying device. This option
55+ has security implications; please read the LUKS documentation before
56+ activating it.
57+ '';
58+ };
5059 };
5160
5261 };
@@ -224,7 +233,8 @@ in
224233 fi
225234 ''}
226235 ${optionalString sw.randomEncryption.enable ''
227− cryptsetup plainOpen -c ${sw.randomEncryption.cipher} -d ${sw.randomEncryption.source} ${optionalString (sw.discardPolicy != null) "--allow-discards"} ${sw.device} ${sw.deviceName}
236+ cryptsetup plainOpen -c ${sw.randomEncryption.cipher} -d ${sw.randomEncryption.source} \
237+ ${optionalString sw.randomEncryption.allowDiscards "--allow-discards"} ${sw.device} ${sw.deviceName}
228238 mkswap ${sw.realDevice}
229239 ''}
230240 '';