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
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
# this is unlikely to be the final form or location of this code, it's
|
||||
# an interim module which wraps the uevent-watch command
|
||||
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (pkgs) liminix;
|
||||
in
|
||||
# inherit (pkgs.liminix.services) bundle;
|
||||
in {
|
||||
{
|
||||
options = {
|
||||
system.service.uevent-rule = mkOption {
|
||||
description = "a service which starts other services based on device state (sysfs)";
|
||||
@@ -25,7 +31,7 @@ in {
|
||||
devtype = "usb_device";
|
||||
attrs.idVendor = "8086";
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
symlink = mkOption {
|
||||
description = "create symlink targeted on devpath";
|
||||
|
@@ -1,23 +1,30 @@
|
||||
{
|
||||
liminix
|
||||
, uevent-watch
|
||||
, lib }:
|
||||
liminix,
|
||||
uevent-watch,
|
||||
lib,
|
||||
}:
|
||||
{
|
||||
serviceName, terms, symlink
|
||||
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));
|
||||
stringify =
|
||||
attrs:
|
||||
concatStringsSep " " (
|
||||
collect lib.isString (
|
||||
mapAttrsRecursive (path: value: "${concatStringsSep "." path}=${value}") attrs
|
||||
)
|
||||
);
|
||||
termsString = stringify terms;
|
||||
in longrun {
|
||||
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}";
|
||||
run = "${uevent-watch}/bin/uevent-watch ${
|
||||
if symlink != null then "-n ${symlink}" else ""
|
||||
} -s ${serviceName} ${termsString}";
|
||||
}
|
||||
|
Reference in New Issue
Block a user