mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 22:50:49 +00:00
nixos/zfs: only enable trim if zfs is enabled
Also don't fail the service if there are no pools yet. This might happen on installation ISOs.
This commit is contained in:
parent
0b754fbe54
commit
a412d90e10
|
@ -552,14 +552,14 @@ in
|
|||
};
|
||||
})
|
||||
|
||||
(mkIf cfgTrim.enable {
|
||||
(mkIf (enableZfs && cfgTrim.enable) {
|
||||
systemd.services.zpool-trim = {
|
||||
description = "ZFS pools trim";
|
||||
after = [ "zfs-import.target" ];
|
||||
path = [ packages.zfsUser ];
|
||||
startAt = cfgTrim.interval;
|
||||
script = ''
|
||||
zpool list -H -o name | xargs -n1 zpool trim
|
||||
zpool list -H -o name | xargs --no-run-if-empty -n1 zpool trim
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue