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>
This commit is contained in:
Felix Singer 2021-06-26 03:37:52 +02:00
parent e859759427
commit b7a2309786
5 changed files with 43 additions and 0 deletions

View File

@ -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">

View File

@ -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

View File

@ -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

View File

@ -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 = { };
};
}

View File

@ -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" ];