diff options
author | Felix Singer <felixsinger@posteo.net> | 2021-06-26 03:37:52 +0200 |
---|---|---|
committer | Felix Singer <felixsinger@posteo.net> | 2021-06-30 03:43:35 +0200 |
commit | b7a2309786b75989fb31816439f7e52a31cc64b3 (patch) | |
tree | 6602920b3c4ac96b9e4e62601e21501eb49acc39 | |
parent | e85975942742a3728226ac22a3415f2355bfc897 (diff) | |
download | nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar.gz nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar.bz2 nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar.lz nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar.xz nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.tar.zst nixpkgs-b7a2309786b75989fb31816439f7e52a31cc64b3.zip |
flashrom: Install udev-rules file
Add the udev-rules file from flashrom source to the out directory. The file contains rules for programmers used by flashrom. Members of the `flashrom` system group are allowed to access these devices. Also, add a module for installing flashrom and adding flashrom to udev packages. The module can be used by setting `programs.flashrom.enable` to `true`. Signed-off-by: Felix Singer <felixsinger@posteo.net>
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2111.section.xml | 8 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2111.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/programs/flashrom.nix | 26 | ||||
-rw-r--r-- | pkgs/tools/misc/flashrom/default.nix | 6 |
5 files changed, 43 insertions, 0 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 896a797cefb..abd10a6f9a7 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -48,6 +48,14 @@ <link xlink:href="options.html#opt-networking.ucarp.enable">networking.ucarp</link>. </para> </listitem> + <listitem> + <para> + Users of flashrom should migrate to + <link xlink:href="options.html#opt-programs.flashrom.enable">programs.flashrom.enable</link> + and add themselves to the <literal>flashrom</literal> group to + be able to access programmers supported by flashrom. + </para> + </listitem> </itemizedlist> </section> <section xml:id="sec-release-21.11-incompatibilities"> diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index afb12996041..1b7250a1815 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -16,6 +16,8 @@ In addition to numerous new and upgraded packages, this release has the followin - [ucarp](https://download.pureftpd.org/pub/ucarp/README), an userspace implementation of the Common Address Redundancy Protocol (CARP). Available as [networking.ucarp](options.html#opt-networking.ucarp.enable). +- Users of flashrom should migrate to [programs.flashrom.enable](options.html#opt-programs.flashrom.enable) and add themselves to the `flashrom` group to be able to access programmers supported by flashrom. + ## Backward Incompatibilities {#sec-release-21.11-incompatibilities} - The `staticjinja` package has been upgraded from 1.0.4 to 2.0.0 diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 8a96b42c556..a54533f7af1 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -138,6 +138,7 @@ ./programs/file-roller.nix ./programs/firejail.nix ./programs/fish.nix + ./programs/flashrom.nix ./programs/flexoptix-app.nix ./programs/freetds.nix ./programs/fuse.nix diff --git a/nixos/modules/programs/flashrom.nix b/nixos/modules/programs/flashrom.nix new file mode 100644 index 00000000000..f026c2e31cd --- /dev/null +++ b/nixos/modules/programs/flashrom.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.flashrom; +in +{ + options.programs.flashrom = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Installs flashrom and configures udev rules for programmers + used by flashrom. Grants access to users in the "flashrom" + group. + ''; + }; + }; + + config = mkIf cfg.enable { + services.udev.packages = [ pkgs.flashrom ]; + environment.systemPackages = [ pkgs.flashrom ]; + users.groups.flashrom = { }; + }; +} diff --git a/pkgs/tools/misc/flashrom/default.nix b/pkgs/tools/misc/flashrom/default.nix index 66a8b213403..07a2d02b0b2 100644 --- a/pkgs/tools/misc/flashrom/default.nix +++ b/pkgs/tools/misc/flashrom/default.nix @@ -19,11 +19,17 @@ stdenv.mkDerivation rec { sha256 = "0ax4kqnh7kd3z120ypgp73qy1knz47l6qxsqzrfkd97mh5cdky71"; }; + postPatch = '' + substituteInPlace util/z60_flashrom.rules \ + --replace "plugdev" "flashrom" + ''; + # Meson build doesn't build and install manpage. Only Makefile can. # Build manpage from source directory. Here we're inside the ./build subdirectory postInstall = '' make flashrom.8 -C .. installManPage ../flashrom.8 + install -Dm644 ../util/z60_flashrom.rules $out/etc/udev/rules.d/flashrom.rules ''; mesonFlags = lib.optionals stdenv.isAarch64 [ "-Dpciutils=false" ]; |