You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
492 B
Nix
22 lines
492 B
Nix
2 months ago
|
{ config, ... }:
|
||
|
let
|
||
|
inherit (builtins) any attrValues elem;
|
||
|
allMounts = attrValues config.fileSystems;
|
||
|
testDiskOption = option: disk: elem option disk.options;
|
||
|
testDiskDiscard = testDiskOption "discard";
|
||
|
in
|
||
|
{
|
||
|
config = {
|
||
|
|
||
|
assertions = [
|
||
|
{
|
||
|
assertion = config.services.fstrim.enable -> !any testDiskDiscard allMounts;
|
||
|
message = ''
|
||
|
enabling "discard" mount option is discouraged because services.fstrim is enabled
|
||
|
'';
|
||
|
}
|
||
|
];
|
||
|
|
||
|
};
|
||
|
}
|