simplify script

This commit is contained in:
Simon Gardling 2025-07-11 00:07:33 -07:00
parent 5597fd9c3b
commit 8e829637ac
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -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";