Merge pull request #128205 from felixsinger/flashrom/add-udev

flashrom: Install udev-rules file
This commit is contained in:
Martin Weinelt 2021-06-30 04:03:56 +02:00 committed by GitHub
commit c865d03690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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" ];