summaryrefslogtreecommitdiffstats
path: root/nixos/modules/tasks
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2019-10-07 10:43:59 +0100
committerJörg Thalheim <joerg@thalheim.io>2019-10-07 10:44:56 +0100
commita412d90e101b94d797f6aca4b96fdac2fd85e599 (patch)
treecc52af42e170ab3d2991223ad62c1095cb925408 /nixos/modules/tasks
parent0b754fbe542a8455d707516188cb3471663b629e (diff)
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.
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r--nixos/modules/tasks/filesystems/zfs.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index cfdc0a31020b..6cfa510a78a4 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -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
'';
};
})