From a412d90e101b94d797f6aca4b96fdac2fd85e599 Mon Sep 17 00:00:00 2001 From: Jörg Thalheim Date: Mon, 7 Oct 2019 10:43:59 +0100 Subject: 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. --- nixos/modules/tasks/filesystems/zfs.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nixos/modules/tasks/filesystems') 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 ''; }; }) -- cgit 1.4.1