From 8e829637ac4e1ac6abe0fe6f47ec49eb572ec9cf Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Fri, 11 Jul 2025 00:07:33 -0700 Subject: [PATCH] simplify script --- flake.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 1daa87e..1a2a68f 100644 --- a/flake.nix +++ b/flake.nix @@ -138,6 +138,7 @@ serviceMountDeps = serviceName: dirs: pkgs: { systemd.services."${serviceName}_mounts" = let + lib = nixpkgs.lib; zfslistmounted = pkgs.writeShellApplication { name = "zfslistmounted"; runtimeInputs = with pkgs; [ @@ -146,16 +147,11 @@ gawk coreutils ]; - text = - let - lib = nixpkgs.lib; - in - '' - #!/bin/sh - zfs get mounted | grep yes | awk '{print $1}' | while read -r i; do zfs get mountpoint "$i" | awk 'FNR==2 {print $3}'; done | grep -c '${lib.strings.concatStringsSep "\|" dirs}' | grep -Fq ${toString (lib.length dirs)} - ''; + text = '' + #!/bin/sh + zfs list -o mountpoint,mounted | awk 'FNR > 1 && $2 == "yes" {print $1}' | grep -c '${lib.strings.concatStringsSep "\|" dirs}' | grep -Fq ${toString (lib.length dirs)} + ''; }; - in { unitConfig.Wants = "zfs.target";