Open maresb opened 7 months ago
With NixOS you might want to use the following:
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0666"
'';
Thanks @FabianRig! Do you know a good way to detect NixOS to determine whether or not this should be suggested? Would you be willing to making a PR for this?
NixOS works a bit differently than most other distributions. You have to edit a config and can't simply call "apt install ...". Therefore, I don't think it's a good idea to go about this manually. Actually, I'm thinking about adding a NixOS module which would add an option (https://search.nixos.org/options) for labelle/udev...
@FabianRig, I've been eyeing NixOS, but haven't yet decided to take the plunge.
For the full context, please note that the idProduct
value is generated dynamically here based on the model of the device that's currently plugged in.
In particular, the udev configuration is meant to be decoupled from the installation process. We don't know ahead-of-time which devices the user will connect, and the udev rule is meant to be device-specific.
Therefore, I don't think it's a good idea to go about this manually.
What's the alternative? I don't like the idea of attempting to add/edit configuration automatically. I'd rather prompt the user with appropriate instructions, and I'm happy to have them be nix-specific when nix is detected.
Actually, I'm thinking about adding a NixOS module which would add an option
That'd be awesome, thanks!!!
@maresb Thank you for the clarification. I overlooked the fact, that the id is generated dynamically...
I could write a NixOS module, but it wouldn't make things any easier because you'd have to configure it yourself. And it wouldn't make your config any easier...
Perhaps, it's a better idea to detect NixOS and to print a string which you can directly import into your configuration.nix?! I did a little test:
import platform
platform.version()
yields '#1-NixOS SMP PREEMPT_DYNAMIC Thu Apr 4 18:23:07 UTC 2024' for me. If we detect that, we could create the above string and simply print it for the user.
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0666"
'';
Then you'd just have to add the above to your configuration.nix and apply it.
Thanks @FabianRig, that sounds great! Would you like to open a PR for that?
Hi, I'm working with a dymo printer LabelWriter 550, connected directly to a Linux machine (Debian 12) but I cannot print when I launch the line labelle "Hello world" The output I get is: "DeviceManagerError: No matching devices found" As the Readme says I added an udev rule with the parameters of my printer that I retrieve using the command "lusb". Some one is having the same issue? Thanks for your help
@jhocan55 please refer to #4 regarding the current status of LabelWriter 550 support.
We strive to make it easy to set up the necessary udev rules in Linux. In case you have any trouble, please discuss it here.