summary refs log tree commit diff
path: root/pkgs/tools/misc/ckb-next
diff options
context:
space:
mode:
authorKier Davis <kierdavis@gmail.com>2018-05-06 19:26:37 +0100
committerKier Davis <kierdavis@gmail.com>2018-10-22 13:23:30 +0100
commit81178785c95e130160ee25673bec10888f662acc (patch)
treefe4713c1382968a3405ff67fc5c41414a387bd0f /pkgs/tools/misc/ckb-next
parent8069b09d057489089257e4790ef5896761e3024c (diff)
downloadnixpkgs-81178785c95e130160ee25673bec10888f662acc.tar
nixpkgs-81178785c95e130160ee25673bec10888f662acc.tar.gz
nixpkgs-81178785c95e130160ee25673bec10888f662acc.tar.bz2
nixpkgs-81178785c95e130160ee25673bec10888f662acc.tar.lz
nixpkgs-81178785c95e130160ee25673bec10888f662acc.tar.xz
nixpkgs-81178785c95e130160ee25673bec10888f662acc.tar.zst
nixpkgs-81178785c95e130160ee25673bec10888f662acc.zip
ckb, ckb module: rename to ckb-next
The upstream package has officially changed its name to ckb-next.
Diffstat (limited to 'pkgs/tools/misc/ckb-next')
-rw-r--r--pkgs/tools/misc/ckb-next/ckb-modprobe.patch26
-rw-r--r--pkgs/tools/misc/ckb-next/default.nix43
-rw-r--r--pkgs/tools/misc/ckb-next/install-dirs.patch32
-rw-r--r--pkgs/tools/misc/ckb-next/systemd-service.patch45
4 files changed, 146 insertions, 0 deletions
diff --git a/pkgs/tools/misc/ckb-next/ckb-modprobe.patch b/pkgs/tools/misc/ckb-next/ckb-modprobe.patch
new file mode 100644
index 00000000000..f2156fc3b23
--- /dev/null
+++ b/pkgs/tools/misc/ckb-next/ckb-modprobe.patch
@@ -0,0 +1,26 @@
+diff --git a/src/daemon/input_linux.c b/src/daemon/input_linux.c
+index 1cedb07..8e0b24b 100644
+--- a/src/daemon/input_linux.c
++++ b/src/daemon/input_linux.c
+@@ -58,7 +58,7 @@ int os_inputopen(usbdevice* kb){
+     /// First check whether the uinput module is loaded by the kernel.
+     ///
+     // Load the uinput module (if it's not loaded already)
+-    if(system("modprobe uinput") != 0) {
++    if(system("@kmod@/bin/modprobe uinput") != 0) {
+         ckb_fatal("Failed to load uinput module\n");
+         return 1;
+     }
+diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
+index 3601146..3f2f78f 100644
+--- a/src/gui/mainwindow.cpp
++++ b/src/gui/mainwindow.cpp
+@@ -251,7 +251,7 @@ void MainWindow::updateVersion(){
+             daemonWarning.append(tr("<br /><b>Warning:</b> System Extension by \"Fumihiko Takayama\" is not allowed in Security & Privacy. Please allow it and then unplug and replug your devices."));
+ #elif defined(Q_OS_LINUX)
+             QProcess modprobe;
+-            modprobe.start("modprobe", QStringList("uinput"));
++            modprobe.start("@kmod@/bin/modprobe", QStringList("uinput"));
+ 
+             if(!modprobe.waitForFinished())
+                 qDebug() << "Modprobe error";
diff --git a/pkgs/tools/misc/ckb-next/default.nix b/pkgs/tools/misc/ckb-next/default.nix
new file mode 100644
index 00000000000..15aa4d3c52d
--- /dev/null
+++ b/pkgs/tools/misc/ckb-next/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchFromGitHub, substituteAll, udev
+, pkgconfig, qtbase, cmake, zlib, kmod }:
+
+stdenv.mkDerivation rec {
+  version = "0.3.2";
+  name = "ckb-next-${version}";
+
+  src = fetchFromGitHub {
+    owner = "ckb-next";
+    repo = "ckb-next";
+    rev = "v${version}";
+    sha256 = "0ri5n7r1vhsgk6s64abvqcdrs5fmlwprw0rxiwfy0j8a9qcic1dr";
+  };
+
+  buildInputs = [
+    udev
+    qtbase
+    zlib
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    cmake
+  ];
+
+  patches = [
+    ./install-dirs.patch
+    ./systemd-service.patch
+    (substituteAll {
+      name = "ckb-modprobe.patch";
+      src = ./ckb-modprobe.patch;
+      inherit kmod;
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Driver and configuration tool for Corsair keyboards and mice";
+    homepage = https://github.com/ckb-next/ckb-next;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ kierdavis ];
+  };
+}
diff --git a/pkgs/tools/misc/ckb-next/install-dirs.patch b/pkgs/tools/misc/ckb-next/install-dirs.patch
new file mode 100644
index 00000000000..5545292a65e
--- /dev/null
+++ b/pkgs/tools/misc/ckb-next/install-dirs.patch
@@ -0,0 +1,32 @@
+diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
+index 09056a7..1bb4595 100644
+--- a/src/daemon/CMakeLists.txt
++++ b/src/daemon/CMakeLists.txt
+@@ -456,7 +456,7 @@ endif ()
+ if (LINUX)
+   install(
+     FILES "${CMAKE_SOURCE_DIR}/linux/udev/99-ckb-daemon.rules"
+-    DESTINATION "/etc/udev/rules.d"
++    DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/udev/rules.d"
+     PERMISSIONS
+     OWNER_READ OWNER_WRITE
+     GROUP_READ
+diff --git a/src/libs/ckb-next/CMakeLists.txt b/src/libs/ckb-next/CMakeLists.txt
+index ecc591c..35de563 100644
+--- a/src/libs/ckb-next/CMakeLists.txt
++++ b/src/libs/ckb-next/CMakeLists.txt
+@@ -75,12 +75,12 @@ if(NOT MACOS)
+         NAMESPACE
+           ${CMAKE_PROJECT_NAME}::
+         DESTINATION
+-          "/usr/lib/cmake/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}")
++          "${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}")
+ 
+     install(
+         FILES
+           "cmake/${PROJECT_NAME}Config.cmake"
+           "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake"
+         DESTINATION
+-          "/usr/lib/cmake/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}")
++          "${CMAKE_INSTALL_PREFIX}/lib/cmake/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}")
+ endif()
diff --git a/pkgs/tools/misc/ckb-next/systemd-service.patch b/pkgs/tools/misc/ckb-next/systemd-service.patch
new file mode 100644
index 00000000000..917bc09627f
--- /dev/null
+++ b/pkgs/tools/misc/ckb-next/systemd-service.patch
@@ -0,0 +1,45 @@
+diff --git a/src/daemon/CMakeLists.txt b/src/daemon/CMakeLists.txt
+index 09056a7..72a7249 100644
+--- a/src/daemon/CMakeLists.txt
++++ b/src/daemon/CMakeLists.txt
+@@ -249,12 +249,7 @@ elseif (LINUX)
+     # but it is not enabled by default and systemd is used instead. (Ubuntu 15.04+)
+ 
+     # A way to check for upstart
+-    execute_process(
+-        COMMAND initctl --version
+-        OUTPUT_VARIABLE initctl_output
+-        OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-    if ("${initctl_output}" MATCHES "upstart")
++    if (FALSE)
+         message(STATUS "upstart detected")
+         set(CKB_NEXT_INIT_SYSTEM "upstart" CACHE INTERNAL "")
+         set(DISALLOW_SYSVINIT TRUE)
+@@ -292,7 +287,7 @@ elseif (LINUX)
+     endif ()
+ 
+     # A way to check for systemd
+-    if (EXISTS "/run/systemd/system")
++    if (TRUE)
+         message(STATUS "systemd detected")
+         set(CKB_NEXT_INIT_SYSTEM "systemd" CACHE INTERNAL "")
+         set(DISALLOW_SYSVINIT TRUE)
+@@ -328,7 +323,7 @@ elseif (LINUX)
+     endif ()
+ 
+     # A way to check for OpenRC
+-    if (EXISTS "/run/openrc/softlevel")
++    if (FALSE)
+         message(STATUS "OpenRC detected")
+         set(CKB_NEXT_INIT_SYSTEM "OpenRC" CACHE INTERNAL "")
+         set(DISALLOW_SYSVINIT TRUE)
+@@ -419,7 +414,7 @@ if ("${CKB_NEXT_INIT_SYSTEM}" STREQUAL "launchd")
+ elseif ("${CKB_NEXT_INIT_SYSTEM}" STREQUAL "systemd")
+     install(
+         FILES "${CMAKE_CURRENT_BINARY_DIR}/service/ckb-next-daemon.service"
+-        DESTINATION "/usr/lib/systemd/system"
++        DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system"
+         PERMISSIONS
+         OWNER_READ OWNER_WRITE
+         GROUP_READ