mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-06 12:14:40 +00:00
fetchFromGitHub add LFS support & Spacenav updates (#263120)
This commit is contained in:
commit
464adc0ea6
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -1,33 +1,44 @@
|
||||
{ stdenv, lib, fetchFromGitHub, pkg-config, gtk2 }:
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
pkg-config,
|
||||
libspnav,
|
||||
libX11,
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
# Qt6 support is close: https://github.com/FreeSpacenav/spnavcfg/issues/43
|
||||
libsForQt5,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "spnavcfg";
|
||||
version = "0.3.1";
|
||||
version = "1.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FreeSpacenav";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "180mkdis15gxs79rr3f7hpwa1p6v81bybw37pzzdjnmqwqrc08a0";
|
||||
repo = "spnavcfg";
|
||||
rev = "refs/tags/v${finalAttrs.version}";
|
||||
fetchLFS = true;
|
||||
hash = "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
|
||||
libsForQt5.wrapQtAppsHook
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ gtk2 ];
|
||||
|
||||
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
||||
buildInputs = [
|
||||
libsForQt5.qtbase
|
||||
libspnav
|
||||
libX11
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://spacenav.sourceforge.net/";
|
||||
@ -37,4 +48,4 @@ stdenv.mkDerivation rec {
|
||||
maintainers = with maintainers; [ gebner ];
|
||||
mainProgram = "spnavcfg";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
@ -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";
|
||||
|
@ -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 <sys/select.h>
|
||||
#include "spnav.h"
|
||||
|
||||
-#define SPNAV_SOCK_PATH "/var/run/spnav.sock"
|
||||
+#define DEFAULT_SPNAV_SOCK_PATH "/run/spnav.sock"
|
||||
|
||||
#ifdef USE_X11
|
||||
#include <X11/Xlib.h>
|
||||
@@ -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) {
|
@ -1,26 +1,26 @@
|
||||
{ stdenv, lib, fetchFromGitHub, libX11, fixDarwinDylibNames }:
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
libX11,
|
||||
fixDarwinDylibNames,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "0.2.3";
|
||||
pname = "libspnav";
|
||||
version = "1.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FreeSpacenav";
|
||||
repo = "libspnav";
|
||||
rev = "${pname}-${version}";
|
||||
sha256 = "098h1jhlj87axpza5zgy58prp0zn94wyrbch6x0s7q4mzh7dc8ba";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-qBewSOiwf5iaGKLGRWOQUoHkUADuH8Q1mJCLiWCXmuQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optional stdenv.hostPlatform.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"];
|
||||
configureFlags = [ "--disable-debug" ];
|
||||
makeFlags = [
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
"AR=${stdenv.cc.targetPrefix}ar"
|
||||
|
@ -1,40 +1,37 @@
|
||||
{ stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "0.8";
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
libXext,
|
||||
libX11,
|
||||
IOKit,
|
||||
}:
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "spacenavd";
|
||||
version = "1.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "FreeSpacenav";
|
||||
repo = "spacenavd";
|
||||
rev = "v${version}";
|
||||
sha256 = "1zz0cm5cgvp9s5n4nzksl8rb11c7sw214bdafzra74smvqfjcjcf";
|
||||
rev = "refs/tags/v${finalAttrs.version}";
|
||||
hash = "sha256-26geQYOXjMZZ/FpPpav7zfql0davTBwB4Ir+X1oep9Q=";
|
||||
};
|
||||
|
||||
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.hostPlatform.isDarwin IOKit;
|
||||
buildInputs = [
|
||||
libX11
|
||||
libXext
|
||||
] ++ lib.optional stdenv.hostPlatform.isDarwin IOKit;
|
||||
|
||||
configureFlags = [ "--disable-debug" ];
|
||||
|
||||
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";
|
||||
@ -43,4 +40,4 @@ stdenv.mkDerivation rec {
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ sohalt ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user