commit ddaa23a5168359d2fe16069669f6365620c90ccd
parent 21113590bbb7b290131a09b3b6acc803a1cbeba2
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 21 Jan 2022 09:58:24 +0100
parent 21113590bbb7b290131a09b3b6acc803a1cbeba2
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 21 Jan 2022 09:58:24 +0100
programs/usbmuxd: start it with `--systemd` otherwise it hangs on shutdown
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/configurations/programs/usbmuxd.nix b/configurations/programs/usbmuxd.nix @@ -1,9 +1,36 @@ -{ ... }: +{ pkgs, ... }: { - services = { - usbmuxd.enable = true; +# services = { +# usbmuxd.enable = true; +# }; + + + users.groups.usbmux = {}; + + users.users = { + leah.extraGroups = [ "usbmux" ]; + + usbmux.description = "usbmuxd user"; + usbmux.group = "usbmux"; + usbmux.isSystemUser = true; }; - users.users.leah.extraGroups = [ "usbmux" ]; + # Give usbmuxd permission for Apple devices + services.udev.extraRules = '' + SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", GROUP="usbmux" + ''; + + systemd.services.usbmuxd = { + description = "usbmuxd"; + wantedBy = [ "multi-user.target" ]; + unitConfig.Documentation = "man:usbmuxd(8)"; + serviceConfig = { + # Trigger the udev rule manually. This doesn't require replugging the + # device when first enabling the option to get it to work + ExecStartPre = "${pkgs.udev}/bin/udevadm trigger -s usb -a idVendor=05ac"; + # Start usbmuxd with `--systemd` otherwise it hangs on shutdown + ExecStart = "${pkgs.usbmuxd}/bin/usbmuxd -U usbmux --systemd"; + }; + }; }