···272 </listitem>
273 </varlistentry>
274275+ <varlistentry>
276+ <term><methodname>systemctl</methodname></term>
277+ <listitem>
278+ <para>Runs <literal>systemctl</literal> commands with optional support for
279+ <literal>systemctl --user</literal></para>
280+ <para>
281+ <programlisting>
282+ $machine->systemctl("list-jobs --no-pager"); // runs `systemctl list-jobs --no-pager`
283+ $machine->systemctl("list-jobs --no-pager", "any-user"); // spawns a shell for `any-user` and runs `systemctl --user list-jobs --no-pager`
284+ </programlisting>
285+ </para>
286+ </listitem>
287+ </varlistentry>
288+289</variablelist>
290291+</para>
292+293+<para>
294+ To test user units declared by <literal>systemd.user.services</literal> the optional <literal>$user</literal>
295+ argument can be used:
296+297+ <programlisting>
298+ $machine->start;
299+ $machine->waitForX;
300+ $machine->waitForUnit("xautolock.service", "x-session-user");
301+ </programlisting>
302+303+ This applies to <literal>systemctl</literal>, <literal>getUnitInfo</literal>,
304+ <literal>waitForUnit</literal>, <literal>startJob</literal>
305+ and <literal>stopJob</literal>.
306</para>
307308</section>
+17-3
nixos/doc/manual/installation/installing-usb.xml
···11<command>dd if=<replaceable>path-to-image</replaceable>
12of=<replaceable>/dev/sdb</replaceable></command>. Be careful about specifying the
13correct drive; you can use the <command>lsblk</command> command to get a list of
14-block devices. If you're on macOS you can run <command>diskutil list</command>
15-to see the list of devices; the device you'll use for the USB must be ejected
16-before writing the image.</para>
17000000000000000018<para>The <command>dd</command> utility will write the image verbatim to the drive,
19making it the recommended option for both UEFI and non-UEFI installations. For
20non-UEFI installations, you can alternatively use
···11<command>dd if=<replaceable>path-to-image</replaceable>
12of=<replaceable>/dev/sdb</replaceable></command>. Be careful about specifying the
13correct drive; you can use the <command>lsblk</command> command to get a list of
14+block devices.</para>
001516+<para>On macOS:
17+<programlisting>
18+$ diskutil list
19+[..]
20+/dev/diskN (external, physical):
21+ #: TYPE NAME SIZE IDENTIFIER
22+[..]
23+$ diskutil unmountDisk diskN
24+Unmount of all volumes on diskN was successful
25+$ sudo dd bs=1m if=nix.iso of=/dev/rdiskN
26+</programlisting>
27+Using the 'raw' <command>rdiskN</command> device instead of <command>diskN</command>
28+completes in minutes instead of hours. After <command>dd</command> completes, a GUI
29+dialog "The disk you inserted was not readable by this computer" will pop up, which
30+can be ignored.</para>
31+32<para>The <command>dd</command> utility will write the image verbatim to the drive,
33making it the recommended option for both UEFI and non-UEFI installations. For
34non-UEFI installations, you can alternatively use
+7
nixos/doc/manual/release-notes/rl-1803.xml
···234 to your <literal>configuration.nix</literal>.
235 </para>
236 </listitem>
0000000237</itemizedlist>
238239</section>
···234 to your <literal>configuration.nix</literal>.
235 </para>
236 </listitem>
237+ <listitem>
238+ <para>
239+ The NixOS test driver supports user services declared by <literal>systemd.user.services</literal>.
240+ The methods <literal>waitForUnit</literal>, <literal>getUnitInfo</literal>, <literal>startJob</literal>
241+ and <literal>stopJob</literal> provide an optional <literal>$user</literal> argument for that purpose.
242+ </para>
243+ </listitem>
244</itemizedlist>
245246</section>
···1+{ config, lib, pkgs, ... }:
2+3+with lib;
4+5+let
6+7+ defaultUserGroup = "usbmux";
8+ apple = "05ac";
9+10+ cfg = config.services.usbmuxd;
11+12+in
13+14+{
15+ options.services.usbmuxd = {
16+ enable = mkOption {
17+ type = types.bool;
18+ default = false;
19+ description = ''
20+ Enable the usbmuxd ("USB multiplexing daemon") service. This daemon is
21+ in charge of multiplexing connections over USB to an iOS device. This is
22+ needed for transferring data from and to iOS devices (see ifuse). Also
23+ this may enable plug-n-play tethering for iPhones.
24+ '';
25+ };
26+27+ user = mkOption {
28+ type = types.str;
29+ default = defaultUserGroup;
30+ description = ''
31+ The user usbmuxd should use to run after startup.
32+ '';
33+ };
34+35+ group = mkOption {
36+ type = types.str;
37+ default = defaultUserGroup;
38+ description = ''
39+ The group usbmuxd should use to run after startup.
40+ '';
41+ };
42+ };
43+44+ config = mkIf cfg.enable {
45+46+ users.extraUsers = optional (cfg.user == defaultUserGroup) {
47+ name = cfg.user;
48+ description = "usbmuxd user";
49+ group = cfg.group;
50+ };
51+52+ users.extraGroups = optional (cfg.group == defaultUserGroup) {
53+ name = cfg.group;
54+ };
55+56+ # Give usbmuxd permission for Apple devices
57+ services.udev.extraRules = ''
58+ SUBSYSTEM=="usb", ATTR{idVendor}=="${apple}", GROUP="${cfg.group}"
59+ '';
60+61+ systemd.services.usbmuxd = {
62+ description = "usbmuxd";
63+ wantedBy = [ "multi-user.target" ];
64+ unitConfig.Documentation = "man:usbmuxd(8)";
65+ serviceConfig = {
66+ # Trigger the udev rule manually. This doesn't require replugging the
67+ # device when first enabling the option to get it to work
68+ ExecStartPre = "${pkgs.libudev}/bin/udevadm trigger -s usb -a idVendor=${apple}";
69+ ExecStart = "${pkgs.usbmuxd}/bin/usbmuxd -U ${cfg.user} -f";
70+ };
71+ };
72+73+ };
74+}
···197 "mmc_block"
198199 # Support USB keyboards, in case the boot fails and we only have
200- # a USB keyboard.
201 "uhci_hcd"
202 "ehci_hcd"
203 "ehci_pci"
···206 "xhci_hcd"
207 "xhci_pci"
208 "usbhid"
209- "hid_generic" "hid_lenovo" "hid_apple" "hid_roccat"
210211 # Misc. keyboard stuff.
212 "pcips2" "atkbd" "i8042"
···197 "mmc_block"
198199 # Support USB keyboards, in case the boot fails and we only have
200+ # a USB keyboard, or for LUKS passphrase prompt.
201 "uhci_hcd"
202 "ehci_hcd"
203 "ehci_pci"
···206 "xhci_hcd"
207 "xhci_pci"
208 "usbhid"
209+ "hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" "hid_logitech_hidpp"
210211 # Misc. keyboard stuff.
212 "pcips2" "atkbd" "i8042"
···23stdenv.mkDerivation rec {
4 name = "abcMIDI-${version}";
5- version = "2017.12.20";
67 # You can find new releases on http://ifdo.ca/~seymour/runabc/top.html
8 src = fetchzip {
9 url = "http://ifdo.ca/~seymour/runabc/${name}.zip";
10- sha256 = "0lkbwrh701djbyqmybvx860p8csy25i6p3p7hr0cpndpa496nm07";
11 };
1213 # There is also a file called "makefile" which seems to be preferred by the standard build phase
···23stdenv.mkDerivation rec {
4 name = "abcMIDI-${version}";
5+ version = "2018.01.02";
67 # You can find new releases on http://ifdo.ca/~seymour/runabc/top.html
8 src = fetchzip {
9 url = "http://ifdo.ca/~seymour/runabc/${name}.zip";
10+ sha256 = "0s8wm637dgzgpgdxba3a6fh06i0c4iwvv9cdghh8msnx428k68iw";
11 };
1213 # There is also a file called "makefile" which seems to be preferred by the standard build phase