I want to build a derivation that makes udev changes. Is there something additional I need to consider in such a case? Does it involve:
https://github.com/NixOS/nixpkgs/blob/0bfd0187dafe3f597355e6be16b7b9a5f4b90376/nixos/modules/services/hardware/udev.nix
somehow?
(BTW, the package in question is midisport-firmware
.)
Shou
March 24, 2020, 11:32pm
2
I had a look and the consensus seems to be to add udev rules to $out/lib/udev/rules.d/
and then add the package to services.udev.packages = [ my-package ];
either directly in configuration.nix
or through a module. Below is a couple of example packages that do this.
NixOS:master
← dje4321:brightnessctl
opened 02:42PM - 16 Jun 18 UTC
###### Motivation for this change
Adding brightnessctl for better backlight sup… port. brightnessctl package is what provides the binary and the brightnessctl module enables the udev rule for access from userspace for anyone in the video group.
###### Things done
- [ ] Tested using sandboxing ([nix.useSandbox](http://nixos.org/nixos/manual/options.html#opt-nix.useSandbox) on NixOS, or option `sandbox` in [`nix.conf`](http://nixos.org/nix/manual/#sec-conf-file) on non-NixOS)
- Built on platform(s)
- [X] NixOS
- [ ] macOS
- [ ] other Linux distributions
- [ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside [nixos/tests](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
- [X] Tested execution of all binary files (usually in `./result/bin/`)
- [ ] Tested compilation of all pkgs that depend on this change using `nix-shell -p nox --run "nox-review wip"`
- [ ] Fits [CONTRIBUTING.md](https://github.com/NixOS/nixpkgs/blob/master/.github/CONTRIBUTING.md).
---
{ stdenv, fetchFromGitHub }:
## Usage
# In NixOS, simply add this package to services.udev.packages:
# services.udev.packages = [ pkgs.android-udev-rules ];
stdenv.mkDerivation rec {
pname = "android-udev-rules";
version = "20191103";
src = fetchFromGitHub {
owner = "M0Rf30";
repo = "android-udev-rules";
rev = version;
sha256 = "0x2f2sv0x0ry7kccp47s0hlxps3hbpg37dj3xjjgpdm5hmn2cjq3";
};
installPhase = ''
install -D 51-android.rules $out/lib/udev/rules.d/51-android.rules
'';
This file has been truncated. show original
1 Like
Thanks very much!
Let me chew on that a bit and try it. I’ll report my results back here.
OK, I haven’t had a chance to try this yet because there’s also a firmware component that must be built. The package depends up fxload, which is available. I just need to get a better understanding about how that works in a NixOS context.
Was there ever a solution to this? I’d like to use my m-audio uno interface under nixos.
ah. I don’t really understand how to apply that to making midisport-firmware
available in nixos. I was hoping for a nixos setting perhaps. I’ll have to circle back to this when I have time to delve into what udev is and so forth.
You are probably better off opening a new thread than necrobumping a solved one, then.