wrap uevent-watch in a service
This commit is contained in:
25
modules/service-trigger/rule.nix
Normal file
25
modules/service-trigger/rule.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
liminix
|
||||
, uevent-watch
|
||||
, serviceFns
|
||||
, lib }:
|
||||
{
|
||||
service, 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-${service.name}";
|
||||
isTrigger = true;
|
||||
buildInputs = [ service ];
|
||||
run = "${uevent-watch}/bin/uevent-watch ${if symlink != null then "-n ${symlink}" else ""} -s ${service.name} ${termsString}";
|
||||
}
|
Reference in New Issue
Block a user