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 = {
|
systemd.services.zpool-trim = {
|
||||||
description = "ZFS pools trim";
|
description = "ZFS pools trim";
|
||||||
after = [ "zfs-import.target" ];
|
after = [ "zfs-import.target" ];
|
||||||
path = [ packages.zfsUser ];
|
path = [ packages.zfsUser ];
|
||||||
startAt = cfgTrim.interval;
|
startAt = cfgTrim.interval;
|
||||||
script = ''
|
script = ''
|
||||||
zpool list -H -o name | xargs -n1 zpool trim
|
zpool list -H -o name | xargs --no-run-if-empty -n1 zpool trim
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user