rename service-trigger rule to match service name
This commit is contained in:
23
modules/uevent-rule/rule.nix
Normal file
23
modules/uevent-rule/rule.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
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}";
|
||||
}
|
Reference in New Issue
Block a user