3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/trezor-udev-rules/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

34 lines
1.1 KiB
Nix

{ lib, stdenv, fetchurl }:
stdenv.mkDerivation rec {
pname = "trezor-udev-rules";
version = "unstable-2019-07-17";
udevRules = fetchurl {
# let's pin the latest commit in the repo which touched the udev rules file
url = "https://raw.githubusercontent.com/trezor/trezor-firmware/68a3094b0a8e36b588b1bcb58c34a2c9eafc0dca/common/udev/51-trezor.rules";
sha256 = "0vlxif89nsqpbnbz1vwfgpl1zayzmq87gw1snskn0qns6x2rpczk";
};
dontUnpack = true;
installPhase = ''
cp ${udevRules} 51-trezor.rules
mkdir -p $out/lib/udev/rules.d
# we use trezord group, not plugdev
# we don't need the udev-acl tag
substituteInPlace 51-trezor.rules \
--replace 'GROUP="plugdev"' 'GROUP="trezord"' \
--replace ', TAG+="udev-acl"' ""
cp 51-trezor.rules $out/lib/udev/rules.d/51-trezor.rules
'';
meta = with lib; {
description = "Udev rules for Trezor";
license = licenses.gpl3;
maintainers = with maintainers; [ prusnak ];
platforms = platforms.linux;
homepage = "https://github.com/trezor/trezor-firmware/tree/master/common/udev";
};
}