git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #145050 from bb2020/swap
commit1d30bfc9f13e31d5cb849bbbeddbb00ab9e06d65 authorSandro <sandro.jaeckel@gmail.com> dateMon 8 Nov 2021, 17:28 (5 years ago) parent7c661458a3a429
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 '';