From 85526bce87def0cf74d23065690971e335987f7b Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 6 May 2018 18:58:51 +0100 Subject: [PATCH 1/6] ckb-next: 0.2.9 -> 0.3.2 In this update: * binaries `ckb` and `ckb-daemon` are renamed to `ckb-next` and `ckb-next-daemon` * build system changed from qmake to cmake * the directory searched for animation plugins no longer needs to be patched, as a result of the build system change * modprobe patch has been bumped, since the source repository layout has changed * the cmake scripts are quite FHS-centric and require patching to fix install locations --- nixos/modules/hardware/ckb.nix | 2 +- .../misc/ckb/ckb-animations-location.patch | 12 ----- pkgs/tools/misc/ckb/ckb-modprobe.patch | 35 ++++++++++----- pkgs/tools/misc/ckb/default.nix | 22 +++------ pkgs/tools/misc/ckb/install-dirs.patch | 32 +++++++++++++ pkgs/tools/misc/ckb/systemd-service.patch | 45 +++++++++++++++++++ 6 files changed, 108 insertions(+), 40 deletions(-) delete mode 100644 pkgs/tools/misc/ckb/ckb-animations-location.patch create mode 100644 pkgs/tools/misc/ckb/install-dirs.patch create mode 100644 pkgs/tools/misc/ckb/systemd-service.patch diff --git a/nixos/modules/hardware/ckb.nix b/nixos/modules/hardware/ckb.nix index 8429572a882..a8e697f7939 100644 --- a/nixos/modules/hardware/ckb.nix +++ b/nixos/modules/hardware/ckb.nix @@ -26,7 +26,7 @@ in systemd.services.ckb = { description = "Corsair Keyboard Daemon"; wantedBy = ["multi-user.target"]; - script = "${cfg.package}/bin/ckb-daemon"; + script = "${cfg.package}/bin/ckb-next-daemon"; serviceConfig = { Restart = "always"; StandardOutput = "syslog"; diff --git a/pkgs/tools/misc/ckb/ckb-animations-location.patch b/pkgs/tools/misc/ckb/ckb-animations-location.patch deleted file mode 100644 index 8e53685e76a..00000000000 --- a/pkgs/tools/misc/ckb/ckb-animations-location.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/src/ckb/animscript.cpp b/src/ckb/animscript.cpp -index f49a64c..d7a3459 100644 ---- a/src/ckb/animscript.cpp -+++ b/src/ckb/animscript.cpp -@@ -30,7 +30,7 @@ QString AnimScript::path(){ - #ifdef __APPLE__ - return QDir(QApplication::applicationDirPath() + "/../Resources").absoluteFilePath("ckb-animations"); - #else -- return QDir("/usr/lib").absoluteFilePath("ckb-animations"); -+ return QDir(QApplication::applicationDirPath() + "/../libexec").absoluteFilePath("ckb-animations"); - #endif - } diff --git a/pkgs/tools/misc/ckb/ckb-modprobe.patch b/pkgs/tools/misc/ckb/ckb-modprobe.patch index 8024151159c..f2156fc3b23 100644 --- a/pkgs/tools/misc/ckb/ckb-modprobe.patch +++ b/pkgs/tools/misc/ckb/ckb-modprobe.patch @@ -1,13 +1,26 @@ -diff --git a/src/ckb-daemon/usb_linux.c b/src/ckb-daemon/usb_linux.c -index 8673f86..4714305 100644 ---- a/src/ckb-daemon/usb_linux.c -+++ b/src/ckb-daemon/usb_linux.c -@@ -440,7 +440,7 @@ static void udev_enum(){ - - int usbmain(){ +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_warn("Failed to load uinput module\n"); +- 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("
Warning: 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")); - // Create the udev object + if(!modprobe.waitForFinished()) + qDebug() << "Modprobe error"; diff --git a/pkgs/tools/misc/ckb/default.nix b/pkgs/tools/misc/ckb/default.nix index 57be1b89e46..15aa4d3c52d 100644 --- a/pkgs/tools/misc/ckb/default.nix +++ b/pkgs/tools/misc/ckb/default.nix @@ -1,15 +1,15 @@ { stdenv, fetchFromGitHub, substituteAll, udev -, pkgconfig, qtbase, qmake, zlib, kmod }: +, pkgconfig, qtbase, cmake, zlib, kmod }: stdenv.mkDerivation rec { - version = "0.2.9"; + version = "0.3.2"; name = "ckb-next-${version}"; src = fetchFromGitHub { owner = "ckb-next"; repo = "ckb-next"; rev = "v${version}"; - sha256 = "0hl41znyhp3k5l9rcgz0gig36gsg95ivrs1dyngv45q9jkr6fchm"; + sha256 = "0ri5n7r1vhsgk6s64abvqcdrs5fmlwprw0rxiwfy0j8a9qcic1dr"; }; buildInputs = [ @@ -20,11 +20,12 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig - qmake + cmake ]; patches = [ - ./ckb-animations-location.patch + ./install-dirs.patch + ./systemd-service.patch (substituteAll { name = "ckb-modprobe.patch"; src = ./ckb-modprobe.patch; @@ -32,17 +33,6 @@ stdenv.mkDerivation rec { }) ]; - doCheck = false; - - installPhase = '' - runHook preInstall - - install -D --mode 0755 --target-directory $out/bin bin/ckb-daemon bin/ckb - install -D --mode 0755 --target-directory $out/libexec/ckb-animations bin/ckb-animations/* - - runHook postInstall - ''; - meta = with stdenv.lib; { description = "Driver and configuration tool for Corsair keyboards and mice"; homepage = https://github.com/ckb-next/ckb-next; diff --git a/pkgs/tools/misc/ckb/install-dirs.patch b/pkgs/tools/misc/ckb/install-dirs.patch new file mode 100644 index 00000000000..5545292a65e --- /dev/null +++ b/pkgs/tools/misc/ckb/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/systemd-service.patch b/pkgs/tools/misc/ckb/systemd-service.patch new file mode 100644 index 00000000000..917bc09627f --- /dev/null +++ b/pkgs/tools/misc/ckb/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 From 8069b09d057489089257e4790ef5896761e3024c Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 6 May 2018 19:23:20 +0100 Subject: [PATCH 2/6] ckb module: update systemd service parameters to match upstream This changes the description and restart mode to the values present in lib/systemd/system/ckb.service within the ckb package. --- nixos/modules/hardware/ckb.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/hardware/ckb.nix b/nixos/modules/hardware/ckb.nix index a8e697f7939..8c0cdbd24d4 100644 --- a/nixos/modules/hardware/ckb.nix +++ b/nixos/modules/hardware/ckb.nix @@ -24,11 +24,11 @@ in environment.systemPackages = [ cfg.package ]; systemd.services.ckb = { - description = "Corsair Keyboard Daemon"; + description = "Corsair Keyboards and Mice Daemon"; wantedBy = ["multi-user.target"]; script = "${cfg.package}/bin/ckb-next-daemon"; serviceConfig = { - Restart = "always"; + Restart = "on-failure"; StandardOutput = "syslog"; }; }; From 81178785c95e130160ee25673bec10888f662acc Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 6 May 2018 19:26:37 +0100 Subject: [PATCH 3/6] ckb, ckb module: rename to ckb-next The upstream package has officially changed its name to ckb-next. --- nixos/doc/manual/release-notes/rl-1903.xml | 7 +++++++ nixos/modules/hardware/{ckb.nix => ckb-next.nix} | 15 ++++++++++----- nixos/modules/module-list.nix | 2 +- .../misc/{ckb => ckb-next}/ckb-modprobe.patch | 0 pkgs/tools/misc/{ckb => ckb-next}/default.nix | 0 .../misc/{ckb => ckb-next}/install-dirs.patch | 0 .../misc/{ckb => ckb-next}/systemd-service.patch | 0 pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 +- 9 files changed, 20 insertions(+), 7 deletions(-) rename nixos/modules/hardware/{ckb.nix => ckb-next.nix} (66%) rename pkgs/tools/misc/{ckb => ckb-next}/ckb-modprobe.patch (100%) rename pkgs/tools/misc/{ckb => ckb-next}/default.nix (100%) rename pkgs/tools/misc/{ckb => ckb-next}/install-dirs.patch (100%) rename pkgs/tools/misc/{ckb => ckb-next}/systemd-service.patch (100%) diff --git a/nixos/doc/manual/release-notes/rl-1903.xml b/nixos/doc/manual/release-notes/rl-1903.xml index 839d75b53bd..3cef0fb1c1d 100644 --- a/nixos/doc/manual/release-notes/rl-1903.xml +++ b/nixos/doc/manual/release-notes/rl-1903.xml @@ -137,6 +137,13 @@ make sure to update your configuration if you want to keep proglodyte-wasm + + + Package ckb is renamed to ckb-next, + and options hardware.ckb.* are renamed to + hardware.ckb-next.*. + + diff --git a/nixos/modules/hardware/ckb.nix b/nixos/modules/hardware/ckb-next.nix similarity index 66% rename from nixos/modules/hardware/ckb.nix rename to nixos/modules/hardware/ckb-next.nix index 8c0cdbd24d4..0316d7cf411 100644 --- a/nixos/modules/hardware/ckb.nix +++ b/nixos/modules/hardware/ckb-next.nix @@ -3,17 +3,22 @@ with lib; let - cfg = config.hardware.ckb; + cfg = config.hardware.ckb-next; in { - options.hardware.ckb = { + imports = [ + (mkRenamedOptionModule ["hardware" "ckb" "enable"] ["hardware" "ckb-next" "enable"]) + (mkRenamedOptionModule ["hardware" "ckb" "package"] ["hardware" "ckb-next" "package"]) + ]; + + options.hardware.ckb-next = { enable = mkEnableOption "the Corsair keyboard/mouse driver"; package = mkOption { type = types.package; - default = pkgs.ckb; - defaultText = "pkgs.ckb"; + default = pkgs.ckb-next; + defaultText = "pkgs.ckb-next"; description = '' The package implementing the Corsair keyboard/mouse driver. ''; @@ -23,7 +28,7 @@ in config = mkIf cfg.enable { environment.systemPackages = [ cfg.package ]; - systemd.services.ckb = { + systemd.services.ckb-next = { description = "Corsair Keyboards and Mice Daemon"; wantedBy = ["multi-user.target"]; script = "${cfg.package}/bin/ckb-next-daemon"; diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index fb6b4262568..5158fcac492 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -34,7 +34,7 @@ ./config/zram.nix ./hardware/all-firmware.nix ./hardware/brightnessctl.nix - ./hardware/ckb.nix + ./hardware/ckb-next.nix ./hardware/cpu/amd-microcode.nix ./hardware/cpu/intel-microcode.nix ./hardware/digitalbitbox.nix diff --git a/pkgs/tools/misc/ckb/ckb-modprobe.patch b/pkgs/tools/misc/ckb-next/ckb-modprobe.patch similarity index 100% rename from pkgs/tools/misc/ckb/ckb-modprobe.patch rename to pkgs/tools/misc/ckb-next/ckb-modprobe.patch diff --git a/pkgs/tools/misc/ckb/default.nix b/pkgs/tools/misc/ckb-next/default.nix similarity index 100% rename from pkgs/tools/misc/ckb/default.nix rename to pkgs/tools/misc/ckb-next/default.nix diff --git a/pkgs/tools/misc/ckb/install-dirs.patch b/pkgs/tools/misc/ckb-next/install-dirs.patch similarity index 100% rename from pkgs/tools/misc/ckb/install-dirs.patch rename to pkgs/tools/misc/ckb-next/install-dirs.patch diff --git a/pkgs/tools/misc/ckb/systemd-service.patch b/pkgs/tools/misc/ckb-next/systemd-service.patch similarity index 100% rename from pkgs/tools/misc/ckb/systemd-service.patch rename to pkgs/tools/misc/ckb-next/systemd-service.patch diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index a0f611dd961..728fd6b71b8 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -59,6 +59,7 @@ mapAliases ({ cantarell_fonts = cantarell-fonts; # added 2018-03-03 checkbashism = checkbashisms; # added 2016-08-16 cifs_utils = cifs-utils; # added 2016-08 + ckb = ckb-next; # added 2018-10-21 clangAnalyzer = clang-analyzer; # added 2015-02-20 clawsMail = claws-mail; # added 2016-04-29 clutter_gtk = clutter-gtk; # added 2018-02-25 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cfbc6687f9d..0f3c36d00f0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1987,7 +1987,7 @@ with pkgs; checkbashisms = callPackage ../development/tools/misc/checkbashisms { }; - ckb = libsForQt5.callPackage ../tools/misc/ckb { }; + ckb-next = libsForQt5.callPackage ../tools/misc/ckb-next { }; clamav = callPackage ../tools/security/clamav { }; From dfdaf39ec3b5995e85c3783eb878b60aed893b62 Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 6 May 2018 19:47:58 +0100 Subject: [PATCH 4/6] ckb module: use exec when starting the daemon process This avoids leaving the parent shell process (the one executing the unit script) lying around. --- nixos/modules/hardware/ckb-next.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/hardware/ckb-next.nix b/nixos/modules/hardware/ckb-next.nix index 0316d7cf411..7c8e0f55958 100644 --- a/nixos/modules/hardware/ckb-next.nix +++ b/nixos/modules/hardware/ckb-next.nix @@ -31,7 +31,7 @@ in systemd.services.ckb-next = { description = "Corsair Keyboards and Mice Daemon"; wantedBy = ["multi-user.target"]; - script = "${cfg.package}/bin/ckb-next-daemon"; + script = "exec ${cfg.package}/bin/ckb-next-daemon"; serviceConfig = { Restart = "on-failure"; StandardOutput = "syslog"; From 7a0d8496537a8b31a0697a8d08fa042837fb467c Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Sun, 6 May 2018 19:49:51 +0100 Subject: [PATCH 5/6] ckb-next: rename ckb-modprobe.patch to modprobe.patch This keeps the naming consistent with the other two patches in this directory. --- pkgs/tools/misc/ckb-next/default.nix | 4 ++-- .../misc/ckb-next/{ckb-modprobe.patch => modprobe.patch} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename pkgs/tools/misc/ckb-next/{ckb-modprobe.patch => modprobe.patch} (100%) diff --git a/pkgs/tools/misc/ckb-next/default.nix b/pkgs/tools/misc/ckb-next/default.nix index 15aa4d3c52d..fdb0f008a6c 100644 --- a/pkgs/tools/misc/ckb-next/default.nix +++ b/pkgs/tools/misc/ckb-next/default.nix @@ -27,8 +27,8 @@ stdenv.mkDerivation rec { ./install-dirs.patch ./systemd-service.patch (substituteAll { - name = "ckb-modprobe.patch"; - src = ./ckb-modprobe.patch; + name = "ckb-next-modprobe.patch"; + src = ./modprobe.patch; inherit kmod; }) ]; diff --git a/pkgs/tools/misc/ckb-next/ckb-modprobe.patch b/pkgs/tools/misc/ckb-next/modprobe.patch similarity index 100% rename from pkgs/tools/misc/ckb-next/ckb-modprobe.patch rename to pkgs/tools/misc/ckb-next/modprobe.patch From de009133d4a9cf1fbde924c55e207ebf40fefc40 Mon Sep 17 00:00:00 2001 From: Kier Davis Date: Tue, 6 Nov 2018 00:50:00 +0000 Subject: [PATCH 6/6] ckb-next: move option renames to nixos/modules/rename.nix for consistency --- nixos/modules/hardware/ckb-next.nix | 5 ----- nixos/modules/rename.nix | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/nixos/modules/hardware/ckb-next.nix b/nixos/modules/hardware/ckb-next.nix index 7c8e0f55958..a275fb8fd60 100644 --- a/nixos/modules/hardware/ckb-next.nix +++ b/nixos/modules/hardware/ckb-next.nix @@ -7,11 +7,6 @@ let in { - imports = [ - (mkRenamedOptionModule ["hardware" "ckb" "enable"] ["hardware" "ckb-next" "enable"]) - (mkRenamedOptionModule ["hardware" "ckb" "package"] ["hardware" "ckb-next" "package"]) - ]; - options.hardware.ckb-next = { enable = mkEnableOption "the Corsair keyboard/mouse driver"; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index aa2b5c0b2df..dc0a175d5bb 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -282,6 +282,10 @@ with lib; (mkRenamedOptionModule [ "programs" "man" "enable" ] [ "documentation" "man" "enable" ]) (mkRenamedOptionModule [ "services" "nixosManual" "enable" ] [ "documentation" "nixos" "enable" ]) + # ckb + (mkRenamedOptionModule [ "hardware" "ckb" "enable" ] [ "hardware" "ckb-next" "enable" ]) + (mkRenamedOptionModule [ "hardware" "ckb" "package" ] [ "hardware" "ckb-next" "package" ]) + ] ++ (flip map [ "blackboxExporter" "collectdExporter" "fritzboxExporter" "jsonExporter" "minioExporter" "nginxExporter" "nodeExporter" "snmpExporter" "unifiExporter" "varnishExporter" ]