forked from mirrors/nixpkgs
Merge pull request #64552 from evanjs/feature/openrazer-2.3.1
openrazer: init at 2.6.0
This commit is contained in:
commit
ce944b4bde
|
@ -5415,6 +5415,12 @@
|
||||||
githubId = 852967;
|
githubId = 852967;
|
||||||
name = "Russell O'Connor";
|
name = "Russell O'Connor";
|
||||||
};
|
};
|
||||||
|
roelvandijk = {
|
||||||
|
email = "roel@lambdacube.nl";
|
||||||
|
github = "roelvandijk";
|
||||||
|
githubId = 710906;
|
||||||
|
name = "Roel van Dijk";
|
||||||
|
};
|
||||||
romildo = {
|
romildo = {
|
||||||
email = "malaquias@gmail.com";
|
email = "malaquias@gmail.com";
|
||||||
github = "romildo";
|
github = "romildo";
|
||||||
|
|
133
nixos/modules/hardware/openrazer.nix
Normal file
133
nixos/modules/hardware/openrazer.nix
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.hardware.openrazer;
|
||||||
|
kernelPackages = config.boot.kernelPackages;
|
||||||
|
|
||||||
|
toPyBoolStr = b: if b then "True" else "False";
|
||||||
|
|
||||||
|
daemonExe = "${pkgs.openrazer-daemon}/bin/openrazer-daemon --config ${daemonConfFile}";
|
||||||
|
|
||||||
|
daemonConfFile = pkgs.writeTextFile {
|
||||||
|
name = "razer.conf";
|
||||||
|
text = ''
|
||||||
|
[General]
|
||||||
|
verbose_logging = ${toPyBoolStr cfg.verboseLogging}
|
||||||
|
|
||||||
|
[Startup]
|
||||||
|
sync_effects_enabled = ${toPyBoolStr cfg.syncEffectsEnabled}
|
||||||
|
devices_off_on_screensaver = ${toPyBoolStr cfg.devicesOffOnScreensaver}
|
||||||
|
mouse_battery_notifier = ${toPyBoolStr cfg.mouseBatteryNotifier}
|
||||||
|
|
||||||
|
[Statistics]
|
||||||
|
key_statistics = ${toPyBoolStr cfg.keyStatistics}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
dbusServiceFile = pkgs.writeTextFile rec {
|
||||||
|
name = "org.razer.service";
|
||||||
|
destination = "/share/dbus-1/services/${name}";
|
||||||
|
text = ''
|
||||||
|
[D-BUS Service]
|
||||||
|
Name=org.razer
|
||||||
|
Exec=${daemonExe}
|
||||||
|
SystemdService=openrazer-daemon.service
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
drivers = [
|
||||||
|
"razerkbd"
|
||||||
|
"razermouse"
|
||||||
|
"razerfirefly"
|
||||||
|
"razerkraken"
|
||||||
|
"razermug"
|
||||||
|
"razercore"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
hardware.openrazer = {
|
||||||
|
enable = mkEnableOption "OpenRazer drivers and userspace daemon.";
|
||||||
|
|
||||||
|
verboseLogging = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable verbose logging. Logs debug messages.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
syncEffectsEnabled = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Set the sync effects flag to true so any assignment of
|
||||||
|
effects will work across devices.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
devicesOffOnScreensaver = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Turn off the devices when the systems screensaver kicks in.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
mouseBatteryNotifier = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Mouse battery notifier.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
keyStatistics = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Collects number of keypresses per hour per key used to
|
||||||
|
generate a heatmap.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
boot.extraModulePackages = [ kernelPackages.openrazer ];
|
||||||
|
boot.kernelModules = drivers;
|
||||||
|
|
||||||
|
# Makes the man pages available so you can succesfully run
|
||||||
|
# > systemctl --user help openrazer-daemon
|
||||||
|
environment.systemPackages = [ pkgs.python3Packages.openrazer-daemon.man ];
|
||||||
|
|
||||||
|
services.udev.packages = [ kernelPackages.openrazer ];
|
||||||
|
services.dbus.packages = [ dbusServiceFile ];
|
||||||
|
|
||||||
|
# A user must be a member of the plugdev group in order to start
|
||||||
|
# the openrazer-daemon. Therefore we make sure that the plugdev
|
||||||
|
# group exists.
|
||||||
|
users.groups.plugdev = {};
|
||||||
|
|
||||||
|
systemd.user.services.openrazer-daemon = {
|
||||||
|
description = "Daemon to manage razer devices in userspace";
|
||||||
|
unitConfig.Documentation = "man:openrazer-daemon(8)";
|
||||||
|
# Requires a graphical session so the daemon knows when the screensaver
|
||||||
|
# starts. See the 'devicesOffOnScreensaver' option.
|
||||||
|
wantedBy = [ "graphical-session.target" ];
|
||||||
|
partOf = [ "graphical-session.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "dbus";
|
||||||
|
BusName = "org.razer";
|
||||||
|
ExecStart = "${daemonExe} --foreground";
|
||||||
|
Restart = "always";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
maintainers = with lib.maintainers; [ roelvandijk ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -58,6 +58,7 @@
|
||||||
./hardware/network/intel-2200bg.nix
|
./hardware/network/intel-2200bg.nix
|
||||||
./hardware/nitrokey.nix
|
./hardware/nitrokey.nix
|
||||||
./hardware/opengl.nix
|
./hardware/opengl.nix
|
||||||
|
./hardware/openrazer.nix
|
||||||
./hardware/pcmcia.nix
|
./hardware/pcmcia.nix
|
||||||
./hardware/printers.nix
|
./hardware/printers.nix
|
||||||
./hardware/raid/hpsa.nix
|
./hardware/raid/hpsa.nix
|
||||||
|
|
17
pkgs/development/python-modules/openrazer/common.nix
Normal file
17
pkgs/development/python-modules/openrazer/common.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
}: rec {
|
||||||
|
version = "2.6.0";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "openrazer";
|
||||||
|
repo = "openrazer";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "1s5irs3avrlp891mxan3z8p55ias9rq26rqp2qrlcc6i4vl29di0";
|
||||||
|
};
|
||||||
|
meta = with stdenv.lib; {
|
||||||
|
homepage = https://openrazer.github.io/;
|
||||||
|
license = licenses.gpl2;
|
||||||
|
maintainers = with maintainers; [ roelvandijk ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
45
pkgs/development/python-modules/openrazer/daemon.nix
Normal file
45
pkgs/development/python-modules/openrazer/daemon.nix
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
{ buildPythonApplication
|
||||||
|
, daemonize
|
||||||
|
, dbus-python
|
||||||
|
, fetchFromGitHub
|
||||||
|
, fetchpatch
|
||||||
|
, gobject-introspection
|
||||||
|
, gtk3
|
||||||
|
, makeWrapper
|
||||||
|
, pygobject3
|
||||||
|
, pyudev
|
||||||
|
, setproctitle
|
||||||
|
, stdenv
|
||||||
|
, wrapGAppsHook
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
common = import ./common.nix { inherit stdenv fetchFromGitHub; };
|
||||||
|
in
|
||||||
|
buildPythonApplication (common // rec {
|
||||||
|
pname = "openrazer_daemon";
|
||||||
|
|
||||||
|
sourceRoot = "source/daemon";
|
||||||
|
|
||||||
|
outputs = [ "out" "man" ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ makeWrapper wrapGAppsHook ];
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
daemonize
|
||||||
|
dbus-python
|
||||||
|
gobject-introspection
|
||||||
|
gtk3
|
||||||
|
pygobject3
|
||||||
|
pyudev
|
||||||
|
setproctitle
|
||||||
|
];
|
||||||
|
|
||||||
|
postBuild = ''
|
||||||
|
DESTDIR="$out" PREFIX="" make install manpages
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = common.meta // {
|
||||||
|
description = "An entirely open source user-space daemon that allows you to manage your Razer peripherals on GNU/Linux";
|
||||||
|
};
|
||||||
|
})
|
26
pkgs/development/python-modules/openrazer/pylib.nix
Normal file
26
pkgs/development/python-modules/openrazer/pylib.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{ buildPythonPackage
|
||||||
|
, dbus-python
|
||||||
|
, fetchFromGitHub
|
||||||
|
, numpy
|
||||||
|
, stdenv
|
||||||
|
, openrazer-daemon
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
common = import ./common.nix { inherit stdenv fetchFromGitHub; };
|
||||||
|
in
|
||||||
|
buildPythonPackage (common // rec {
|
||||||
|
pname = "openrazer";
|
||||||
|
|
||||||
|
sourceRoot = "source/pylib";
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
dbus-python
|
||||||
|
numpy
|
||||||
|
openrazer-daemon
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = common.meta // {
|
||||||
|
description = "An entirely open source Python library that allows you to manage your Razer peripherals on GNU/Linux";
|
||||||
|
};
|
||||||
|
})
|
39
pkgs/os-specific/linux/openrazer/driver.nix
Normal file
39
pkgs/os-specific/linux/openrazer/driver.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{ coreutils
|
||||||
|
, fetchFromGitHub
|
||||||
|
, kernel
|
||||||
|
, stdenv
|
||||||
|
, utillinux
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
common = import ../../../development/python-modules/openrazer/common.nix { inherit stdenv fetchFromGitHub; };
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (common // {
|
||||||
|
name = "openrazer-${common.version}-${kernel.version}";
|
||||||
|
|
||||||
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||||
|
|
||||||
|
buildFlags = [
|
||||||
|
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.version}/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 ${utillinux}/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";
|
||||||
|
};
|
||||||
|
})
|
|
@ -15881,6 +15881,8 @@ in
|
||||||
nvidia_x11_beta = nvidiaPackages.beta;
|
nvidia_x11_beta = nvidiaPackages.beta;
|
||||||
nvidia_x11 = nvidiaPackages.stable;
|
nvidia_x11 = nvidiaPackages.stable;
|
||||||
|
|
||||||
|
openrazer = callPackage ../os-specific/linux/openrazer/driver.nix { };
|
||||||
|
|
||||||
ply = callPackage ../os-specific/linux/ply { };
|
ply = callPackage ../os-specific/linux/ply { };
|
||||||
|
|
||||||
r8168 = callPackage ../os-specific/linux/r8168 { };
|
r8168 = callPackage ../os-specific/linux/r8168 { };
|
||||||
|
@ -19875,6 +19877,8 @@ in
|
||||||
|
|
||||||
openmpt123 = callPackage ../applications/audio/openmpt123 { };
|
openmpt123 = callPackage ../applications/audio/openmpt123 { };
|
||||||
|
|
||||||
|
openrazer-daemon = with python3Packages; toPythonApplication openrazer-daemon;
|
||||||
|
|
||||||
opusfile = callPackage ../applications/audio/opusfile { };
|
opusfile = callPackage ../applications/audio/opusfile { };
|
||||||
|
|
||||||
opusTools = callPackage ../applications/audio/opus-tools { };
|
opusTools = callPackage ../applications/audio/opus-tools { };
|
||||||
|
|
|
@ -2588,6 +2588,9 @@ in {
|
||||||
|
|
||||||
odfpy = callPackage ../development/python-modules/odfpy { };
|
odfpy = callPackage ../development/python-modules/odfpy { };
|
||||||
|
|
||||||
|
openrazer = callPackage ../development/python-modules/openrazer/pylib.nix { };
|
||||||
|
openrazer-daemon = callPackage ../development/python-modules/openrazer/daemon.nix { };
|
||||||
|
|
||||||
oset = callPackage ../development/python-modules/oset { };
|
oset = callPackage ../development/python-modules/oset { };
|
||||||
|
|
||||||
pamela = callPackage ../development/python-modules/pamela { };
|
pamela = callPackage ../development/python-modules/pamela { };
|
||||||
|
|
Loading…
Reference in a new issue