From d6f44b2349191eaca586322cf65ef994d619b673 Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 15:54:29 +0200 Subject: [PATCH 1/8] libspnav: 0.2.3 -> 1.1 --- .../libspnav/configure-socket-path.patch | 47 ------------------- .../libraries/libspnav/default.nix | 12 ++--- 2 files changed, 3 insertions(+), 56 deletions(-) delete mode 100644 pkgs/development/libraries/libspnav/configure-socket-path.patch diff --git a/pkgs/development/libraries/libspnav/configure-socket-path.patch b/pkgs/development/libraries/libspnav/configure-socket-path.patch deleted file mode 100644 index 9a8ef0d498115..0000000000000 --- a/pkgs/development/libraries/libspnav/configure-socket-path.patch +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/spnav.c b/spnav.c -index f9e10f8..27149f7 100644 ---- a/spnav.c -+++ b/spnav.c -@@ -36,7 +36,7 @@ OF SUCH DAMAGE. - #include - #include "spnav.h" - --#define SPNAV_SOCK_PATH "/var/run/spnav.sock" -+#define DEFAULT_SPNAV_SOCK_PATH "/run/spnav.sock" - - #ifdef USE_X11 - #include -@@ -70,6 +70,24 @@ static struct event_node *ev_queue, *ev_queue_tail; - /* AF_UNIX socket used for alternative communication with daemon */ - static int sock = -1; - -+static char *spath = NULL; -+ -+static char *socket_path() -+{ -+ char *xdg_runtime_dir; -+ if((xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"))) { -+ if ( spath == NULL ) { -+ spath = malloc(strlen(xdg_runtime_dir) + strlen("/spnav.sock") + 1); -+ if ( spath != NULL ) { -+ sprintf(spath, "%s/spnav.sock", xdg_runtime_dir); -+ } -+ } -+ if(access(spath, F_OK) != -1){ -+ return spath; -+ } -+ } -+ return DEFAULT_SPNAV_SOCK_PATH; -+} - - int spnav_open(void) - { -@@ -92,7 +110,7 @@ int spnav_open(void) - - memset(&addr, 0, sizeof addr); - addr.sun_family = AF_UNIX; -- strncpy(addr.sun_path, SPNAV_SOCK_PATH, sizeof(addr.sun_path)); -+ strncpy(addr.sun_path, socket_path(), sizeof(addr.sun_path)); - - - if(connect(s, (struct sockaddr*)&addr, sizeof addr) == -1) { diff --git a/pkgs/development/libraries/libspnav/default.nix b/pkgs/development/libraries/libspnav/default.nix index d67b12a726b47..e5418935f6dde 100644 --- a/pkgs/development/libraries/libspnav/default.nix +++ b/pkgs/development/libraries/libspnav/default.nix @@ -1,25 +1,19 @@ { stdenv, lib, fetchFromGitHub, libX11, fixDarwinDylibNames }: stdenv.mkDerivation rec { - version = "0.2.3"; + version = "1.1"; pname = "libspnav"; src = fetchFromGitHub { owner = "FreeSpacenav"; repo = "libspnav"; - rev = "${pname}-${version}"; - sha256 = "098h1jhlj87axpza5zgy58prp0zn94wyrbch6x0s7q4mzh7dc8ba"; + rev = "v${version}"; + sha256 = "sha256-qBewSOiwf5iaGKLGRWOQUoHkUADuH8Q1mJCLiWCXmuQ="; }; nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames; buildInputs = [ libX11 ]; - patches = [ - # Changes the socket path from /run/spnav.sock to $XDG_RUNTIME_DIR/spnav.sock - # to allow for a user service - ./configure-socket-path.patch - ]; - configureFlags = [ "--disable-debug"]; makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" From b2e9fff168ca23a8ce7469a5c3b782c4d954767d Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 15:39:47 +0200 Subject: [PATCH 2/8] spacenavd: 0.8 -> 1.2 --- pkgs/misc/drivers/spacenavd/default.nix | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/pkgs/misc/drivers/spacenavd/default.nix b/pkgs/misc/drivers/spacenavd/default.nix index eb2fc165cccbf..cf0a0e7608691 100644 --- a/pkgs/misc/drivers/spacenavd/default.nix +++ b/pkgs/misc/drivers/spacenavd/default.nix @@ -1,33 +1,16 @@ { stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }: stdenv.mkDerivation rec { - version = "0.8"; + version = "1.2"; pname = "spacenavd"; src = fetchFromGitHub { owner = "FreeSpacenav"; repo = "spacenavd"; rev = "v${version}"; - sha256 = "1zz0cm5cgvp9s5n4nzksl8rb11c7sw214bdafzra74smvqfjcjcf"; + sha256 = "sha256-UuM/HTgictvIvlUnHZ5Ha8XwBhDTbt7CG9c4jzKQl0s="; }; - patches = [ - # Fixes Darwin: https://github.com/FreeSpacenav/spacenavd/pull/38 - (fetchpatch { - url = "https://github.com/FreeSpacenav/spacenavd/commit/d6a25d5c3f49b9676d039775efc8bf854737c43c.patch"; - sha256 = "02pdgcvaqc20qf9hi3r73nb9ds7yk2ps9nnxaj0x9p50xjnhfg5c"; - }) - # Changes the socket path from /run/spnav.sock to $XDG_RUNTIME_DIR/spnav.sock - # to allow for a user service - ./configure-socket-path.patch - # Changes the pidfile path from /run/spnavd.pid to $XDG_RUNTIME_DIR/spnavd.pid - # to allow for a user service - ./configure-pidfile-path.patch - # Changes the config file path from /etc/spnavrc to $XDG_CONFIG_HOME/spnavrc or $HOME/.config/spnavrc - # to allow for a user service - ./configure-cfgfile-path.patch - ]; - buildInputs = [ libX11 ] ++ lib.optional stdenv.isDarwin IOKit; From 3e4235b74feaad6bb9082e0c7697702f541b49b7 Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 15:42:16 +0200 Subject: [PATCH 3/8] spacenavd: install upstream systemd unit --- pkgs/misc/drivers/spacenavd/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/misc/drivers/spacenavd/default.nix b/pkgs/misc/drivers/spacenavd/default.nix index cf0a0e7608691..d4e1d2b01be01 100644 --- a/pkgs/misc/drivers/spacenavd/default.nix +++ b/pkgs/misc/drivers/spacenavd/default.nix @@ -18,6 +18,12 @@ stdenv.mkDerivation rec { makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; + postInstall = '' + install -Dm644 $src/contrib/systemd/spacenavd.service -t $out/lib/systemd/system + substituteInPlace $out/lib/systemd/system/spacenavd.service \ + --replace-fail "/usr/local/bin/spacenavd" "$out/bin/spacenavd" + ''; + meta = with lib; { homepage = "https://spacenav.sourceforge.net/"; description = "Device driver and SDK for 3Dconnexion 3D input devices"; From b60d3f6270168bd3560637931a9c42eb320d760b Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 20:33:18 +0200 Subject: [PATCH 4/8] fetchgithub: support fetchLFS --- pkgs/build-support/fetchgithub/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index 4ce3c6e84d768..d27a3df7d3df7 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -4,6 +4,7 @@ lib.makeOverridable ( { owner, repo, rev, name ? "source" , fetchSubmodules ? false, leaveDotGit ? null , deepClone ? false, private ? false, forceFetchGit ? false +, fetchLFS ? false , sparseCheckout ? [] , githubBase ? "github.com", varPrefix ? null , meta ? { } @@ -25,7 +26,7 @@ let }; passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_"; - useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != []); + useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || fetchLFS || (sparseCheckout != []); # We prefer fetchzip in cases we don't need submodules as the hash # is more stable in that case. fetcher = @@ -52,7 +53,7 @@ let fetcherArgs = (if useFetchGit then { - inherit rev deepClone fetchSubmodules sparseCheckout; url = gitRepoUrl; + inherit rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl; } // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; } else { url = "${baseUrl}/archive/${rev}.tar.gz"; From 8a7630460dcef91b7e84f688b450aa74b04b7c44 Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 20:35:17 +0200 Subject: [PATCH 5/8] spnavcfg: 0.3.1 -> 1.1 --- pkgs/applications/misc/spnavcfg/default.nix | 43 ++++++++++++--------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/misc/spnavcfg/default.nix b/pkgs/applications/misc/spnavcfg/default.nix index 921947fc1b808..0fb9a17436575 100644 --- a/pkgs/applications/misc/spnavcfg/default.nix +++ b/pkgs/applications/misc/spnavcfg/default.nix @@ -1,33 +1,40 @@ -{ stdenv, lib, fetchFromGitHub, pkg-config, gtk2 }: - +{ + stdenv, + lib, + fetchFromGitHub, + fetchpatch, + pkg-config, + libspnav, + qtbase, + wrapQtAppsHook, +}: stdenv.mkDerivation rec { pname = "spnavcfg"; - version = "0.3.1"; + version = "1.1"; src = fetchFromGitHub { owner = "FreeSpacenav"; repo = pname; rev = "v${version}"; - sha256 = "180mkdis15gxs79rr3f7hpwa1p6v81bybw37pzzdjnmqwqrc08a0"; + fetchLFS = true; + sha256 = "sha256-P3JYhZnaCxzJETwC4g5m4xAGBk28/Va7Z/ybqwacIaA="; }; patches = [ - # Changes the pidfile path from /run/spnavd.pid to $XDG_RUNTIME_DIR/spnavd.pid - # to allow for a user service - ./configure-pidfile-path.patch - # Changes the config file path from /etc/spnavrc to $XDG_CONFIG_HOME/spnavrc or $HOME/.config/spnavrc - # to allow for a user service - ./configure-cfgfile-path.patch + (fetchpatch { + url = "https://github.com/FreeSpacenav/spnavcfg/commit/fd9aa10fb8e19a257398757943b3d8e79906e583.patch"; + hash = "sha256-XKEyLAFrA4qRU3zkBozblb/fKtLKsaItze0xv1uLnq0="; + }) ]; - postPatch = '' - sed -i s/4775/775/ Makefile.in - ''; - - nativeBuildInputs = [ pkg-config ]; - buildInputs = [ gtk2 ]; - - makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; + nativeBuildInputs = [ + pkg-config + wrapQtAppsHook + ]; + buildInputs = [ + qtbase + libspnav + ]; meta = with lib; { homepage = "https://spacenav.sourceforge.net/"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 804ab2b4ac353..d204be9b3df41 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -38848,7 +38848,7 @@ with pkgs; spacenav-cube-example = callPackage ../applications/misc/spacenav-cube-example { }; - spnavcfg = callPackage ../applications/misc/spnavcfg { }; + spnavcfg = libsForQt5.callPackage ../applications/misc/spnavcfg { }; splix = callPackage ../misc/cups/drivers/splix { }; From 896663ce96858d7c54e12762cc29b90f0ad104d5 Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 13 Oct 2023 21:15:12 +0200 Subject: [PATCH 6/8] nixos/spacenavd: Use upstream module --- nixos/modules/services/hardware/spacenavd.nix | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/nixos/modules/services/hardware/spacenavd.nix b/nixos/modules/services/hardware/spacenavd.nix index c094393569988..db3ab37dc2677 100644 --- a/nixos/modules/services/hardware/spacenavd.nix +++ b/nixos/modules/services/hardware/spacenavd.nix @@ -1,8 +1,13 @@ -{ config, lib, pkgs, ... }: -let cfg = config.hardware.spacenavd; - -in { - +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.hardware.spacenavd; +in +{ options = { hardware.spacenavd = { enable = lib.mkEnableOption "spacenavd to support 3DConnexion devices"; @@ -10,12 +15,9 @@ in { }; config = lib.mkIf cfg.enable { - systemd.user.services.spacenavd = { - description = "Daemon for the Spacenavigator 6DOF mice by 3Dconnexion"; - wantedBy = [ "graphical.target" ]; - serviceConfig = { - ExecStart = "${pkgs.spacenavd}/bin/spacenavd -d -l syslog"; - }; + systemd = { + packages = [ pkgs.spacenavd ]; + services.spacenavd.enable = true; }; }; } From d909e89b6d6c04b8ef8b88504d5a1484aa31bb0f Mon Sep 17 00:00:00 2001 From: sohalt Date: Fri, 21 Jun 2024 14:07:08 -0400 Subject: [PATCH 7/8] spaacenavd: 1.2 -> 1.3 --- pkgs/misc/drivers/spacenavd/default.nix | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/misc/drivers/spacenavd/default.nix b/pkgs/misc/drivers/spacenavd/default.nix index d4e1d2b01be01..162bca50efc08 100644 --- a/pkgs/misc/drivers/spacenavd/default.nix +++ b/pkgs/misc/drivers/spacenavd/default.nix @@ -1,18 +1,26 @@ -{ stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }: - +{ + stdenv, + lib, + fetchFromGitHub, + libXext, + libX11, + IOKit, +}: stdenv.mkDerivation rec { - version = "1.2"; + version = "1.3"; pname = "spacenavd"; src = fetchFromGitHub { owner = "FreeSpacenav"; repo = "spacenavd"; rev = "v${version}"; - sha256 = "sha256-UuM/HTgictvIvlUnHZ5Ha8XwBhDTbt7CG9c4jzKQl0s="; + hash = "sha256-26geQYOXjMZZ/FpPpav7zfql0davTBwB4Ir+X1oep9Q="; }; - buildInputs = [ libX11 ] - ++ lib.optional stdenv.isDarwin IOKit; + buildInputs = [ + libX11 + libXext + ] ++ lib.optional stdenv.isDarwin IOKit; configureFlags = [ "--disable-debug" ]; From 6d3cc7422121699491d4368c153c2928d49d9bc8 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Mon, 4 Nov 2024 09:30:31 -0800 Subject: [PATCH 8/8] spnavcfg: add X11 to the build inputs --- pkgs/applications/misc/spnavcfg/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/applications/misc/spnavcfg/default.nix b/pkgs/applications/misc/spnavcfg/default.nix index 31344c388a272..7b5e3ed47ab77 100644 --- a/pkgs/applications/misc/spnavcfg/default.nix +++ b/pkgs/applications/misc/spnavcfg/default.nix @@ -5,6 +5,7 @@ fetchpatch, pkg-config, libspnav, + libX11, # Qt6 support is close: https://github.com/FreeSpacenav/spnavcfg/issues/43 libsForQt5, @@ -32,9 +33,11 @@ stdenv.mkDerivation (finalAttrs: { pkg-config libsForQt5.wrapQtAppsHook ]; + buildInputs = [ libsForQt5.qtbase libspnav + libX11 ]; meta = with lib; {