2019-08-29 02:13:56 +01:00
|
|
|
{ coreutils
|
|
|
|
, fetchFromGitHub
|
|
|
|
, kernel
|
|
|
|
, stdenv
|
2021-01-11 07:54:33 +00:00
|
|
|
, lib
|
2020-11-24 15:29:28 +00:00
|
|
|
, util-linux
|
2019-08-29 02:13:56 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-01-25 08:26:54 +00:00
|
|
|
common = import ../../../development/python-modules/openrazer/common.nix { inherit lib fetchFromGitHub; };
|
2019-08-29 02:13:56 +01:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation (common // {
|
|
|
|
name = "openrazer-${common.version}-${kernel.version}";
|
|
|
|
|
|
|
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
buildFlags = [
|
2019-11-26 11:05:02 +00:00
|
|
|
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
2019-08-29 02:13:56 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
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 \
|
2020-11-24 15:29:28 +00:00
|
|
|
--replace /usr/bin/logger ${util-linux}/bin/logger \
|
2019-08-29 02:13:56 +01:00
|
|
|
--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";
|
|
|
|
};
|
|
|
|
})
|