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
1 changed files with 2 additions and 2 deletions
|
@ -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