-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usbipd: add usbipd service with autobind #348301
base: master
Are you sure you want to change the base?
usbipd: add usbipd service with autobind #348301
Conversation
4f902bc
to
6934fdb
Compare
Which is more idiomatic here? Disable sandboxing or use |
I have a similar module for running usbip in my internal repos, this implementation this looks fairly similar. One issue I can spot is that this setup does not work if you own or use more than 1 device with the same productId / vendorId, which is suprisingly common if you use more than 1 yubikey. You would be unable to bind more than 1 device, and only the first plugged in device would be bound (and the other ignored). |
That should be all passing now, and it should mount all devices that have the same PID/VID. |
Creates a service for usbipd to run via a unit and add systemd services for devices and automatically bind them via udev.
d1eaaeb
to
d50daf9
Compare
usbipd = { | ||
wantedBy = [ "multi-user.target" ]; | ||
script = '' | ||
${lib.getExe' pkgs.kmod "modprobe"} usbip-host usbip-core |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done via boot.kernelModules already, I think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not, e.g. rke2 does this and several others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rke2 does not set boot.kernelModules. My understanding is that putting something in boot.kernelModules
is almost equivalent to a modprobe
call at boot time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I could get confirmation, I am happy to remove it. Though when I initially tested this case the module was not loaded until after reboot, so that is why I added it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at kernel.nix it seems like it is supposed to autoload, but in my experience it didn’t and the wording seems to indicate otherwise “The set of kernel modules to be loaded in the second stage of the boot process”. In any case I will remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though when I initially tested this case the module was not loaded until after reboot, so that is why I added it.
That is correct. It will not work with a simple nixos-rebuild switch
, only a reboot will apply a change to boot.kernelModules
.
Manage usbip devices with a simple service!
tested on an x86 vm and a raspberry pi 4
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.