diff --git a/nixos/modules/services/hardware/spacenavd.nix b/nixos/modules/services/hardware/spacenavd.nix index 7afae76cc4f..cecc4d6f029 100644 --- a/nixos/modules/services/hardware/spacenavd.nix +++ b/nixos/modules/services/hardware/spacenavd.nix @@ -13,7 +13,7 @@ in { }; config = mkIf cfg.enable { - systemd.user.services.spacenavd = { + systemd.services.spacenavd = { description = "Daemon for the Spacenavigator 6DOF mice by 3Dconnexion"; after = [ "syslog.target" ]; wantedBy = [ "graphical.target" ]; diff --git a/pkgs/applications/graphics/freecad/default.nix b/pkgs/applications/graphics/freecad/default.nix index 47341578862..440cc7fa38d 100644 --- a/pkgs/applications/graphics/freecad/default.nix +++ b/pkgs/applications/graphics/freecad/default.nix @@ -1,4 +1,5 @@ { lib +, stdenv , mkDerivation , fetchFromGitHub , fetchpatch @@ -35,7 +36,7 @@ , scipy , shiboken2 , soqt -, spaceNavSupport ? false +, spaceNavSupport ? stdenv.isLinux , swig , vtk , wrapQtAppsHook diff --git a/pkgs/applications/graphics/openscad/default.nix b/pkgs/applications/graphics/openscad/default.nix index 3accf2fd590..ac41a23f8bb 100644 --- a/pkgs/applications/graphics/openscad/default.nix +++ b/pkgs/applications/graphics/openscad/default.nix @@ -25,6 +25,7 @@ , mkDerivation , qtmacextras , qmake +, spacenavSupport ? stdenv.isLinux, libspnav }: mkDerivation rec { @@ -46,9 +47,15 @@ mkDerivation rec { qtbase qtmultimedia qscintilla ] ++ lib.optionals stdenv.isLinux [ libGLU libGL ] ++ lib.optional stdenv.isDarwin qtmacextras + ++ lib.optional spacenavSupport libspnav ; - qmakeFlags = [ "VERSION=${version}" ]; + qmakeFlags = [ "VERSION=${version}" ] ++ + lib.optionals spacenavSupport [ + "ENABLE_SPNAV=1" + "SPNAV_INCLUDEPATH=${libspnav}/include" + "SPNAV_LIBPATH=${libspnav}/lib" + ]; # src/lexer.l:36:10: fatal error: parser.hxx: No such file or directory enableParallelBuilding = false; # true by default due to qmake diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 69f0d58159e..5df5dad519a 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -7,7 +7,7 @@ , jackaudioSupport ? false, libjack2 , cudaSupport ? config.cudaSupport or false, cudatoolkit , colladaSupport ? true, opencollada -, spaceNavSupport ? false, libspnav +, spaceNavSupport ? stdenv.isLinux, libspnav , makeWrapper , pugixml, llvmPackages, SDL, Cocoa, CoreGraphics, ForceFeedback, OpenAL, OpenGL , embree, gmp diff --git a/pkgs/applications/misc/spnavcfg/default.nix b/pkgs/applications/misc/spnavcfg/default.nix new file mode 100644 index 00000000000..caeaa42192d --- /dev/null +++ b/pkgs/applications/misc/spnavcfg/default.nix @@ -0,0 +1,28 @@ +{ stdenv, lib, fetchFromGitHub, pkg-config, gtk2 }: + +stdenv.mkDerivation rec { + pname = "spnavcfg"; + version = "0.3.1"; + + src = fetchFromGitHub { + owner = "FreeSpacenav"; + repo = pname; + rev = "v${version}"; + sha256 = "180mkdis15gxs79rr3f7hpwa1p6v81bybw37pzzdjnmqwqrc08a0"; + }; + + postPatch = '' + sed -i s/4775/775/ Makefile.in + ''; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ gtk2 ]; + + meta = with lib; { + homepage = "http://spacenav.sourceforge.net/"; + description = "Interactive configuration GUI for space navigator input devices"; + license = licenses.gpl3Plus; + platforms = platforms.unix; + maintainers = with maintainers; [ gebner ]; + }; +} 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 2c315067f41..00000000000 --- 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, sizeof(spath), "%s/spnav.sock", xdg_runtime_dir); -+ } -+ } -+ if(access(spath, F_OK)){ -+ 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 9bd0a67041b..fb2a2744d6a 100644 --- a/pkgs/development/libraries/libspnav/default.nix +++ b/pkgs/development/libraries/libspnav/default.nix @@ -13,12 +13,6 @@ stdenv.mkDerivation rec { 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"]; preInstall = '' diff --git a/pkgs/misc/drivers/spacenavd/configure-socket-path.patch b/pkgs/misc/drivers/spacenavd/configure-socket-path.patch deleted file mode 100644 index 03eb329f4b6..00000000000 --- a/pkgs/misc/drivers/spacenavd/configure-socket-path.patch +++ /dev/null @@ -1,118 +0,0 @@ -diff --git a/src/proto_unix.c b/src/proto_unix.c -index 998f234..d38452c 100644 ---- a/src/proto_unix.c -+++ b/src/proto_unix.c -@@ -36,11 +36,14 @@ enum { - - static int lsock = -1; - -+static char *spath = NULL; -+ - int init_unix(void) - { - int s; - mode_t prev_umask; - struct sockaddr_un addr; -+ char *sock_path; - - if(lsock >= 0) return 0; - -@@ -49,16 +52,18 @@ int init_unix(void) - return -1; - } - -- unlink(SOCK_NAME); /* in case it already exists */ -+ sock_path = socket_path(); -+ -+ unlink(sock_path); /* in case it already exists */ - - memset(&addr, 0, sizeof addr); - addr.sun_family = AF_UNIX; -- strcpy(addr.sun_path, SOCK_NAME); -+ strcpy(addr.sun_path, sock_path); - - prev_umask = umask(0); - - if(bind(s, (struct sockaddr*)&addr, sizeof addr) == -1) { -- logmsg(LOG_ERR, "failed to bind unix socket: %s: %s\n", SOCK_NAME, strerror(errno)); -+ logmsg(LOG_ERR, "failed to bind unix socket: %s: %s\n", sock_path, strerror(errno)); - close(s); - return -1; - } -@@ -68,7 +73,7 @@ int init_unix(void) - if(listen(s, 8) == -1) { - logmsg(LOG_ERR, "listen failed: %s\n", strerror(errno)); - close(s); -- unlink(SOCK_NAME); -+ unlink(sock_path); - return -1; - } - -@@ -82,7 +87,7 @@ void close_unix(void) - close(lsock); - lsock = -1; - -- unlink(SOCK_NAME); -+ unlink(socket_path()); - } - } - -@@ -173,3 +178,19 @@ int handle_uevents(fd_set *rset) - - return 0; - } -+ -+char *socket_path(void) -+{ -+ 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); -+ } -+ }; -+ return spath; -+ } else { -+ return DEFAULT_SOCK_NAME; -+ } -+} -diff --git a/src/proto_unix.h b/src/proto_unix.h -index 045b379..ec4509c 100644 ---- a/src/proto_unix.h -+++ b/src/proto_unix.h -@@ -23,6 +23,7 @@ along with this program. If not, see . - #include "event.h" - #include "client.h" - -+char *socket_path(void); - int init_unix(void); - void close_unix(void); - int get_unix_socket(void); -diff --git a/src/spnavd.c b/src/spnavd.c -index cbea191..03080da 100644 ---- a/src/spnavd.c -+++ b/src/spnavd.c -@@ -344,7 +344,7 @@ static int find_running_daemon(void) - } - memset(&addr, 0, sizeof addr); - addr.sun_family = AF_UNIX; -- strncpy(addr.sun_path, SOCK_NAME, sizeof addr.sun_path); -+ strncpy(addr.sun_path, socket_path(), sizeof addr.sun_path); - - if(connect(s, (struct sockaddr*)&addr, sizeof addr) == -1) { - close(s); -diff --git a/src/spnavd.h b/src/spnavd.h -index fa0a916..deea4e0 100644 ---- a/src/spnavd.h -+++ b/src/spnavd.h -@@ -26,7 +26,8 @@ along with this program. If not, see . - #define DEF_CFGFILE "/etc/spnavrc" - #define DEF_LOGFILE "/var/log/spnavd.log" - --#define SOCK_NAME "/var/run/spnav.sock" -+#define DEFAULT_SOCK_NAME "/run/spnav.sock" -+#define SOCK_NAME_ENV "SPNAVD_SOCK_LOCATION" - #define PIDFILE "/var/run/spnavd.pid" - #define SYSLOG_ID "spnavd" - diff --git a/pkgs/misc/drivers/spacenavd/default.nix b/pkgs/misc/drivers/spacenavd/default.nix index 1051d469f61..734b2229c87 100644 --- a/pkgs/misc/drivers/spacenavd/default.nix +++ b/pkgs/misc/drivers/spacenavd/default.nix @@ -13,12 +13,6 @@ stdenv.mkDerivation rec { 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"]; meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5d41b8fb10f..b71536e73e4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30074,6 +30074,8 @@ in spacenav-cube-example = callPackage ../applications/misc/spacenav-cube-example { }; + spnavcfg = callPackage ../applications/misc/spnavcfg { }; + splix = callPackage ../misc/cups/drivers/splix { }; steamcontroller = callPackage ../misc/drivers/steamcontroller { };