Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchFromGitHub add LFS support & Spacenav updates #263120

Merged
merged 9 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions nixos/modules/services/hardware/spacenavd.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{ 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";
};
};

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;
};
};
}
43 changes: 25 additions & 18 deletions pkgs/applications/misc/spnavcfg/default.nix
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
{ stdenv, lib, fetchFromGitHub, pkg-config, gtk2 }:

{
stdenv,
lib,
fetchFromGitHub,
fetchpatch,
pkg-config,
libspnav,
qtbase,
philiptaron marked this conversation as resolved.
Show resolved Hide resolved
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/";
Expand Down
5 changes: 3 additions & 2 deletions pkgs/build-support/fetchgithub/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? { }
Expand All @@ -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 =
Expand All @@ -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";
Expand Down
47 changes: 0 additions & 47 deletions pkgs/development/libraries/libspnav/configure-socket-path.patch

This file was deleted.

12 changes: 3 additions & 9 deletions pkgs/development/libraries/libspnav/default.nix
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
{ stdenv, lib, fetchFromGitHub, libX11, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
version = "0.2.3";
version = "1.1";
pname = "libspnav";
philiptaron marked this conversation as resolved.
Show resolved Hide resolved

src = fetchFromGitHub {
owner = "FreeSpacenav";
repo = "libspnav";
rev = "${pname}-${version}";
sha256 = "098h1jhlj87axpza5zgy58prp0zn94wyrbch6x0s7q4mzh7dc8ba";
rev = "v${version}";
philiptaron marked this conversation as resolved.
Show resolved Hide resolved
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"
Expand Down
43 changes: 20 additions & 23 deletions pkgs/misc/drivers/spacenavd/default.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }:

{
stdenv,
lib,
fetchFromGitHub,
libXext,
libX11,
IOKit,
}:
stdenv.mkDerivation rec {
version = "0.8";
version = "1.3";
pname = "spacenavd";
philiptaron marked this conversation as resolved.
Show resolved Hide resolved

src = fetchFromGitHub {
owner = "FreeSpacenav";
repo = "spacenavd";
rev = "v${version}";
sha256 = "1zz0cm5cgvp9s5n4nzksl8rb11c7sw214bdafzra74smvqfjcjcf";
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.isDarwin IOKit;
buildInputs = [
libX11
libXext
] ++ lib.optional stdenv.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"
'';
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved

meta = with lib; {
homepage = "https://spacenav.sourceforge.net/";
description = "Device driver and SDK for 3Dconnexion 3D input devices";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
philiptaron marked this conversation as resolved.
Show resolved Hide resolved

splix = callPackage ../misc/cups/drivers/splix { };

Expand Down