nixpkgs/pkgs/os-specific/linux/openrazer/driver.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

41 lines
1.3 KiB
Nix

{ coreutils
, fetchFromGitHub
, kernel
, stdenv
, lib
, util-linux
}:
let
common = import ../../../development/python-modules/openrazer/common.nix { inherit lib stdenv fetchFromGitHub; };
in
stdenv.mkDerivation (common // {
name = "openrazer-${common.version}-${kernel.version}";
nativeBuildInputs = kernel.moduleBuildDependencies;
buildFlags = [
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
installPhase = ''
binDir="$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/hid"
mkdir -p "$binDir"
cp -v driver/*.ko "$binDir"
RAZER_MOUNT_OUT="$out/bin/razer_mount"
RAZER_RULES_OUT="$out/etc/udev/rules.d/99-razer.rules"
install -m 644 -v -D install_files/udev/99-razer.rules $RAZER_RULES_OUT
install -m 755 -v -D install_files/udev/razer_mount $RAZER_MOUNT_OUT
substituteInPlace $RAZER_RULES_OUT \
--replace razer_mount $RAZER_MOUNT_OUT
substituteInPlace $RAZER_MOUNT_OUT \
--replace /usr/bin/logger ${util-linux}/bin/logger \
--replace chgrp ${coreutils}/bin/chgrp \
--replace "PATH='/sbin:/bin:/usr/sbin:/usr/bin'" ""
'';
meta = common.meta // {
description = "An entirely open source Linux driver that allows you to manage your Razer peripherals on GNU/Linux";
};
})