rule.nix (648B)
1 { 2 liminix, 3 uevent-watch, 4 lib, 5 }: 6 { 7 serviceName, 8 terms, 9 symlink, 10 }: 11 let 12 inherit (liminix.services) longrun; 13 inherit (lib.attrsets) collect mapAttrsRecursive; 14 inherit (lib.strings) concatStringsSep; 15 stringify = 16 attrs: 17 concatStringsSep " " ( 18 collect lib.isString ( 19 mapAttrsRecursive (path: value: "${concatStringsSep "." path}=${value}") attrs 20 ) 21 ); 22 termsString = stringify terms; 23 in 24 longrun { 25 name = "watch-for-${serviceName}"; 26 restart-on-upgrade = true; 27 run = "${uevent-watch}/bin/uevent-watch ${ 28 if symlink != null then "-n ${symlink}" else "" 29 } -s ${serviceName} ${termsString}"; 30 }