1
0
liminix/modules/uevent-rule/rule.nix
Daniel Barlow 7e2b0068e6 nixfmt-rfc-style
There is nothing in this commit except for the changes made by
nix-shell -p nixfmt-rfc-style --run "nixfmt ."

If this has mucked up your open branches then sorry about that. You
can probably nixfmt them to match before merging
2025-02-10 21:55:08 +00:00

31 lines
648 B
Nix

{
liminix,
uevent-watch,
lib,
}:
{
serviceName,
terms,
symlink,
}:
let
inherit (liminix.services) longrun;
inherit (lib.attrsets) collect mapAttrsRecursive;
inherit (lib.strings) concatStringsSep;
stringify =
attrs:
concatStringsSep " " (
collect lib.isString (
mapAttrsRecursive (path: value: "${concatStringsSep "." path}=${value}") attrs
)
);
termsString = stringify terms;
in
longrun {
name = "watch-for-${serviceName}";
restart-on-upgrade = true;
run = "${uevent-watch}/bin/uevent-watch ${
if symlink != null then "-n ${symlink}" else ""
} -s ${serviceName} ${termsString}";
}