nixpkgs/pkgs/by-name/tr/trezor-udev-rules/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

36 lines
1.1 KiB
Nix

{ lib, stdenv, fetchurl, nixosTests }:
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
'';
passthru.tests = { inherit (nixosTests) trezord; };
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";
};
}