ctucx.git: nixfiles

ctucx' nixfiles

1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
27 
28 
29 
30 
31 
32 
33 
34 
35 
36 
{ pkgs, ... }:

{
#  services = {
#    usbmuxd.enable      = true;
#  };


  users.groups.usbmux = {};

	users.users = {
    katja.extraGroups    = [ "usbmux" ];

    usbmux.description  = "usbmuxd user";
    usbmux.group        = "usbmux";
    usbmux.isSystemUser = true;
  };

  # 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";
    };
  };
}