-
Notifications
You must be signed in to change notification settings - Fork 142
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
Using FTDI in NixOS / with read-only '/etc' #534
Comments
For reference, here's I don't see |
Thanks @zh4ngx, can you post here what you get using |
Sure thing:
|
Ok, thanks. So you are using the release apio and your platform was identified as a standard linux. Below is the code (in the apio dev branch, 0.9.6) which installs the ftdi drivers on linux. Line 227 in b2bad1b
Any suggestions on...
Edit: one valid solution for question 2 is to print to the user instructions on how to install manually. This is how we handle windows: Line 19 in b2bad1b
|
Thanks, that is super helpful. Is the following a good characterization of FTDI install?
On point 3., there's an assumption that the A few approaches
|
Thanks @zh4ngx, the three steps that you describe seems to be correct. In case we will stay with the existing apio installation process and then use the apio drivers command to install the drivers...
|
Ok, it sounds like option 2. I'm not super well-versed in
Definitely worth giving this approach a try at is should be a smaller lift. If it doesn't work, we can always try option 1. |
It looks like the maintainer is @Luflosi https://github.com/NixOS/nixpkgs/commits/master/pkgs/development/embedded/fpga/apio/default.nix |
Hello 👋 I'm the "maintainer". On NixOS Unfortunately I won't have much time in the next two months, so I can't implement this right now. I do have a small NixOS module that worked for me a long time ago: { config, lib, ... }:
let
cfg = config.hardware.fomu;
in
{
options.hardware.fomu = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc ''
Enables Fomu udev rules and ensures 'fomu' group exists.
This is a prerequisite to using Fomu devices without being root, since Fomu USB descriptors will be owned by the fomu group through udev.
'';
};
users = lib.mkOption {
type = with lib.types; listOf str;
default = [];
description = lib.mdDoc ''
Usernames to be added to the "fomu" group, so that they
can interact with the Fomu device.
'';
};
};
config = lib.mkIf cfg.enable {
users.groups.fomu = {
members = cfg.users;
};
services.udev.extraRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="5bf0", MODE="0664", GROUP="fomu"
'';
};
meta.maintainers = with lib.maintainers; [ Luflosi ];
} This is specific to the fomu and doesn't work for any other board. You could use it as a starting point though.
I encourage you to try to implement this and make a PR to Nixpkgs. Otherwise please open an issue instead (and ping me there). If you just want a quick and hacky workaround for the moment, I think you can |
Thanks @Luflosi. This is very useful! A side question, with the current apio installation (that is, not via a nix package), what is a stable and clean way for apio (and for any other program for that matter) to test if it runs under a nix managed linux? |
Very much appreciate the detailed writeup as well @Luflosi In case this is informative/helpful, here is a paste from
Does this tell us anything interesting/useful about existing FTDI drivers? |
Regarding the Or are you saying this file doesn't exist in NixOS at all? |
Great news! I was able to run services.udev.packages = lib.mkIf cfg.enableFtdiDrivers [
(pkgs.writeTextFile {
name = "ftdi-udev-rules";
text = ''ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", TAG+="uaccess"'';
destination = "/etc/udev/rules.d/70-ftdi.rules";
})
]; For NixOS users, you can essentially skip the programs.apio = {
enable = true;
enableFtdiDrivers = true;
}; It would be great to use/update the udev rules here as described below:
@zapta Do we need to move + rename the rules in this repo or is there a better approach? @Luflosi Is it correct to say udev rules ( |
I'm running NixOS and currently running into a FTDI issues.
I can't enable due to '/etc/' not being writable in Nix:
Just to confirm, can't list ftdi devices, although I'm not super clear what the error message means:
Is there a way around having to modify
/etc/udev/rules.d/
? Or is the error indicative of something else?The text was updated successfully, but these errors were encountered: