From 5533f8b7189ec31d7b2fae429662d9e5d67c05fe Mon Sep 17 00:00:00 2001 From: Kyle Chui Date: Sun, 18 Feb 2024 01:05:22 -0800 Subject: [PATCH] logiops: 0.2.3 -> 0.3.3 feat: Add multiple version support. refactor: Remove unnecessary code. The `DBus` handling is already done via the changed patch file. chore: Fix formatting. refactor: Remove confusing comment. refactor: Abide by `by-name` CI. https://github.com/NixOS/nixpkgs/actions/runs/7968015723/job/21751618054?pr=289701 fix: Remove unnecessary CMake build flag. Nixpkgs already always builds Release, so this is redundant. --- pkgs/by-name/lo/logiops/package.nix | 56 +++++++++++++++++++ ..._POLICY_INSTALL_DIR-externally-overr.patch | 30 ++++++++++ .../lo/logiops_0_2_3/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 - 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/lo/logiops/package.nix create mode 100644 pkgs/by-name/lo/logiops/pkgs0001-Make-DBUS_SYSTEM_POLICY_INSTALL_DIR-externally-overr.patch rename pkgs/{misc/drivers/logiops/default.nix => by-name/lo/logiops_0_2_3/package.nix} (100%) diff --git a/pkgs/by-name/lo/logiops/package.nix b/pkgs/by-name/lo/logiops/package.nix new file mode 100644 index 000000000000..e8cb020a32c5 --- /dev/null +++ b/pkgs/by-name/lo/logiops/package.nix @@ -0,0 +1,56 @@ +{ + lib, + stdenv, + fetchFromGitHub, + pkg-config, + cmake, + glib, + udev, + libevdev, + libconfig, +}: + +stdenv.mkDerivation (oldAttrs: { + pname = "logiops"; + version = "0.3.3"; + + src = fetchFromGitHub { + owner = "PixlOne"; + repo = "logiops"; + rev = "v${oldAttrs.version}"; + sha256 = "sha256-9nFTud5szQN8jpG0e/Bkp+I9ELldfo66SdfVCUTuekg="; + # In v0.3.0, the `ipcgull` submodule was added as a dependency + # https://github.com/PixlOne/logiops/releases/tag/v0.3.0 + fetchSubmodules = true; + }; + + patches = [ + ./pkgs0001-Make-DBUS_SYSTEM_POLICY_INSTALL_DIR-externally-overr.patch + ]; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + buildInputs = [ + udev + libevdev + libconfig + glib + ]; + + cmakeFlags = [ + "-DLOGIOPS_VERSION=${oldAttrs.version}" + "-DDBUS_SYSTEM_POLICY_INSTALL_DIR=${placeholder "out"}/share/dbus-1/system.d" + ]; + + PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system"; + + meta = with lib; { + description = "Unofficial userspace driver for HID++ Logitech devices"; + homepage = "https://github.com/PixlOne/logiops"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ ckie ]; + platforms = with platforms; linux; + }; +}) diff --git a/pkgs/by-name/lo/logiops/pkgs0001-Make-DBUS_SYSTEM_POLICY_INSTALL_DIR-externally-overr.patch b/pkgs/by-name/lo/logiops/pkgs0001-Make-DBUS_SYSTEM_POLICY_INSTALL_DIR-externally-overr.patch new file mode 100644 index 000000000000..1c3ab61dd601 --- /dev/null +++ b/pkgs/by-name/lo/logiops/pkgs0001-Make-DBUS_SYSTEM_POLICY_INSTALL_DIR-externally-overr.patch @@ -0,0 +1,30 @@ +From b7588376e20661c8d79e7472732244c70b8e7d3f Mon Sep 17 00:00:00 2001 +From: ckie +Date: Mon, 16 Oct 2023 02:02:38 +0300 +Subject: [PATCH] Make DBUS_SYSTEM_POLICY_INSTALL_DIR externally overrideable + +--- + src/logid/CMakeLists.txt | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/logid/CMakeLists.txt b/src/logid/CMakeLists.txt +index b2616c8..58d6719 100644 +--- a/src/logid/CMakeLists.txt ++++ b/src/logid/CMakeLists.txt +@@ -111,9 +111,11 @@ elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR) + endif () + + # Install DBus conf +-# TODO: Is there a better way of setting the system policy directory? +-set(DBUS_SYSTEM_POLICY_INSTALL_DIR "/usr/share/dbus-1/system.d") + configure_file(logiops-dbus.conf.in ${CMAKE_BINARY_DIR}/pizza.pixl.LogiOps.conf) ++if (NOT DEFINED DBUS_SYSTEM_POLICY_INSTALL_DIR) ++ # TODO: Is there a better way of setting the system policy directory? ++ set(DBUS_SYSTEM_POLICY_INSTALL_DIR "/usr/share/dbus-1/system.d") ++endif () + message(STATUS "dbus system policy will be installed at ${DBUS_SYSTEM_POLICY_INSTALL_DIR}") + install(FILES ${CMAKE_BINARY_DIR}/pizza.pixl.LogiOps.conf + DESTINATION ${DBUS_SYSTEM_POLICY_INSTALL_DIR} +-- +2.42.0 + diff --git a/pkgs/misc/drivers/logiops/default.nix b/pkgs/by-name/lo/logiops_0_2_3/package.nix similarity index 100% rename from pkgs/misc/drivers/logiops/default.nix rename to pkgs/by-name/lo/logiops_0_2_3/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 99742c68bbf4..331ad27c3c80 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -29407,8 +29407,6 @@ with pkgs; lmodern = callPackage ../data/fonts/lmodern { }; - logiops = callPackage ../misc/drivers/logiops { }; - # ltunifi and solaar both provide udev rules but solaar's rules are more # up-to-date so we simply use that instead of having to maintain our own rules logitech-udev-rules = solaar.udev;