I have a systemd device,
dev-vboxguest.device, which is created through an udev rule in nixpkgs/virtualbox-guest.nix at 4263ba5e133cc3fc699c1152ab5ee46ef668e675 · NixOS/nixpkgs · GitHub.
Now I want to adjust the (start) timeout of this device in my system configuration, but there are no
systemd.devices.* options, only for services etc. How can I adjust this timeout?
Background: I have a setup where I can either boot into my nixos, or where I can boot the nixos from another OS through Virtualbox’s raw physical disk access. When I boot natively however, the
dev-vboxguest.device won’t appear (which makes sense), but causes a 90s delay in my boot process.
Found it, the solution for my case was:
systemd.units."dev-vboxguest.device".text = ''
Which doesn’t set a timeout, but explicitly only activates (or tries to activate) the device when booting in VirtualBox.
Edit: It seems this is already done by the nixos-module: nixpkgs/virtualbox-guest.nix at master · NixOS/nixpkgs · GitHub
What I needed was to disable the network interface that VirtualBox provides when booting natively, i.e.:
systemd.units."sys-subsystem-net-devices-enp0s3.device".text = ''
And enable the device that appears when booting natively with a similar unit that specifies
Everything works fine during boot, but without specifying
dev-vboxguest.device, it seems that
nixos-rebuild switch tries to start
dev-vboxguest.device (or probably rather
virtualbox.service) and times out waiting for, taking 1:30m again.