1
0
Fork 0

update all calls to uevent-watch

This commit is contained in:
Daniel Barlow 2024-06-02 20:40:56 +01:00
parent 884d8d194e
commit c8c79fd75a
3 changed files with 13 additions and 16 deletions

View File

@ -47,11 +47,9 @@ let
setup = bundle { setup = bundle {
name = "modemm-mm-mm-mm"; name = "modemm-mm-mm-mm";
contents = [ contents = [
(longrun { (svc.uevent-rule.build {
name = "watch-for-usb-modeswitch"; service = modeswitch;
isTrigger = true; terms = { devtype = "usb_device"; product = "12d1/14fe/102"; };
buildInputs = [ modeswitch ];
run = "${uevent-watch}/bin/uevent-watch -s ${modeswitch.name} devtype=usb_device product=12d1/14fe/102";
}) })
(svc.uevent-rule.build { (svc.uevent-rule.build {
service = atz; service = atz;

View File

@ -19,9 +19,9 @@ in {
type = liminix.lib.types.serviceDefn; type = liminix.lib.types.serviceDefn;
}; };
}; };
imports = [ ../mdevd.nix ]; imports = [ ../mdevd.nix ../service-trigger ];
config.system.service.mount = config.system.service.mount =
let svc = liminix.callService ./service.nix { let svc = config.system.callService ./service.nix {
partlabel = mkOption { partlabel = mkOption {
type = types.str; type = types.str;
example = "my-usb-stick"; example = "my-usb-stick";

View File

@ -1,7 +1,7 @@
{ {
liminix liminix
, uevent-watch
, lib , lib
, svc
}: }:
{ partlabel, mountpoint, options, fstype }: { partlabel, mountpoint, options, fstype }:
let let
@ -15,12 +15,11 @@ let
up = "mount -t ${fstype} ${options_string} ${device} ${mountpoint}"; up = "mount -t ${fstype} ${options_string} ${device} ${mountpoint}";
down = "umount ${mountpoint}"; down = "umount ${mountpoint}";
}; };
in longrun { in svc.uevent-rule.build {
name = "watch-mount.${lib.strings.sanitizeDerivationName mountpoint}"; service = mount_service;
isTrigger = true; symlink = device;
buildInputs = [ mount_service ]; terms = {
partname = partlabel;
run = '' devtype = "partition";
${uevent-watch}/bin/uevent-watch -s ${mount_service.name} -n ${device} partname=${partlabel} devtype=partition };
'';
} }