-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
openrazer: init at 2.6.0 #64552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
openrazer: init at 2.6.0 #64552
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d9f95c1
maintainers: add roelvandijk to maintainers
evanjs 50eba5b
pythonPackages.openrazer: init at 2.6.0
evanjs bcbadc5
kernel: openrazer: init at 2.6.0
evanjs d2c4d4d
openrazer-daemon: init at 2.6.0
evanjs e9b167b
nixos/hardware/openrazer: init at 2.6.0
evanjs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"; | ||
| }; | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"; | ||
| }; | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| { coreutils | ||
| , fetchFromGitHub | ||
| , kernel | ||
| , stdenv | ||
| , utillinux | ||
| }: | ||
|
|
||
| let | ||
| common = import ../../../development/python-modules/openrazer/common.nix { inherit stdenv fetchFromGitHub; }; | ||
evanjs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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"; | ||
| }; | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.