forked from mirrors/nixpkgs
Merge staging-next into staging
This commit is contained in:
commit
d0c1f6a78f
|
@ -13,13 +13,12 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.spacenavd = {
|
||||
systemd.user.services.spacenavd = {
|
||||
description = "Daemon for the Spacenavigator 6DOF mice by 3Dconnexion";
|
||||
after = [ "syslog.target" ];
|
||||
wantedBy = [ "graphical.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.spacenavd}/bin/spacenavd -d -l syslog";
|
||||
StandardError = "syslog";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,6 +12,8 @@ let
|
|||
|
||||
isNix23 = versionAtLeast nixVersion "2.3pre";
|
||||
|
||||
isNix24 = versionAtLeast nixVersion "2.4pre";
|
||||
|
||||
makeNixBuildUser = nr: {
|
||||
name = "nixbld${toString nr}";
|
||||
value = {
|
||||
|
@ -41,7 +43,11 @@ let
|
|||
max-jobs = ${toString (cfg.maxJobs)}
|
||||
cores = ${toString (cfg.buildCores)}
|
||||
sandbox = ${if (builtins.isBool cfg.useSandbox) then boolToString cfg.useSandbox else cfg.useSandbox}
|
||||
extra-sandbox-paths = ${toString cfg.sandboxPaths}
|
||||
${if isNix24 then ''
|
||||
sandbox-paths = ${toString cfg.sandboxPaths}
|
||||
'' else ''
|
||||
extra-sandbox-paths = ${toString cfg.sandboxPaths}
|
||||
''}
|
||||
substituters = ${toString cfg.binaryCaches}
|
||||
trusted-substituters = ${toString cfg.trustedBinaryCaches}
|
||||
trusted-public-keys = ${toString cfg.binaryCachePublicKeys}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
, opencascade-occt
|
||||
, pivy
|
||||
, pkg-config
|
||||
, ply
|
||||
, pycollada
|
||||
, pyside2
|
||||
, pyside2-tools
|
||||
|
@ -80,6 +81,7 @@ mkDerivation rec {
|
|||
ode
|
||||
opencascade-occt
|
||||
pivy
|
||||
ply # for openSCAD file support
|
||||
pycollada
|
||||
pyside2
|
||||
pyside2-tools
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
, x11Support ? true
|
||||
|
||||
, ConfigArgParse
|
||||
, pyxdg
|
||||
, rofi
|
||||
, wl-clipboard
|
||||
, wtype
|
||||
|
@ -16,18 +15,18 @@
|
|||
|
||||
buildPythonApplication rec {
|
||||
pname = "rofimoji";
|
||||
version = "4.3.0";
|
||||
version = "5.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "fdw";
|
||||
repo = "rofimoji";
|
||||
rev = version;
|
||||
sha256 = "08ayndpifr04njpijc5n5ii5nvibfpab39p6ngyyj0pb43792a8j";
|
||||
sha256 = "sha256-bLV0hYDjVH11euvNHUHZFcCVywuceRljkCqyX4aANVs=";
|
||||
};
|
||||
|
||||
# `rofi` and the `waylandSupport` and `x11Support` dependencies
|
||||
# contain binaries needed at runtime.
|
||||
propagatedBuildInputs = with lib; [ ConfigArgParse pyxdg rofi ]
|
||||
propagatedBuildInputs = with lib; [ ConfigArgParse rofi ]
|
||||
++ optionals waylandSupport [ wl-clipboard wtype ]
|
||||
++ optionals x11Support [ xdotool xsel ];
|
||||
|
||||
|
@ -35,7 +34,6 @@ buildPythonApplication rec {
|
|||
# and has additional dependencies.
|
||||
postPatch = ''
|
||||
rm -rf extractors
|
||||
substituteInPlace setup.py --replace 'pyxdg==0.26' 'pyxdg'
|
||||
'';
|
||||
|
||||
# no tests executed
|
||||
|
|
100
pkgs/applications/misc/spnavcfg/configure-cfgfile-path.patch
Normal file
100
pkgs/applications/misc/spnavcfg/configure-cfgfile-path.patch
Normal file
|
@ -0,0 +1,100 @@
|
|||
diff --git a/back.c b/back.c
|
||||
index c1810dc..75416fb 100644
|
||||
--- a/back.c
|
||||
+++ b/back.c
|
||||
@@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "cfgfile.h"
|
||||
#include "cmd.h"
|
||||
|
||||
-#define CFGFILE "/etc/spnavrc"
|
||||
|
||||
int get_daemon_pid(void);
|
||||
static int update_cfg(void);
|
||||
@@ -127,7 +126,7 @@ int get_daemon_pid(void)
|
||||
|
||||
static int update_cfg(void)
|
||||
{
|
||||
- if(write_cfg(CFGFILE, &cfg) == -1) {
|
||||
+ if(write_cfg(cfg_path(), &cfg) == -1) {
|
||||
fprintf(stderr, "failed to update config file\n");
|
||||
return -1;
|
||||
}
|
||||
diff --git a/cfgfile.c b/cfgfile.c
|
||||
index 5a9c502..2ea323d 100644
|
||||
--- a/cfgfile.c
|
||||
+++ b/cfgfile.c
|
||||
@@ -22,12 +22,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
+#include <unistd.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <pwd.h>
|
||||
#include "cfgfile.h"
|
||||
|
||||
enum {TX, TY, TZ, RX, RY, RZ};
|
||||
|
||||
static const int def_axmap[] = {0, 2, 1, 3, 5, 4};
|
||||
static const int def_axinv[] = {0, 1, 1, 0, 1, 1};
|
||||
+static char* config_path;
|
||||
+
|
||||
+char* cfg_path()
|
||||
+{
|
||||
+ char* buf;
|
||||
+ if((buf = getenv("XDG_CONFIG_HOME"))) {
|
||||
+ if(config_path == NULL) {
|
||||
+ config_path = malloc(strlen(buf) + strlen("/spnavrc") + 1);
|
||||
+ if ( config_path != NULL) {
|
||||
+ sprintf(config_path, "%s/spnavrc", buf);
|
||||
+ }
|
||||
+ };
|
||||
+ return config_path;
|
||||
+ } else {
|
||||
+ if (!(buf = getenv("HOME"))) {
|
||||
+ struct passwd *pw = getpwuid(getuid());
|
||||
+ buf = pw->pw_dir;
|
||||
+ }
|
||||
+ config_path = malloc(strlen(buf) + strlen("/.config/spnavrc") + 1);
|
||||
+ if ( config_path != NULL) {
|
||||
+ sprintf(config_path, "%s/.config/spnavrc", buf);
|
||||
+ }
|
||||
+ return config_path;
|
||||
+ }
|
||||
+}
|
||||
|
||||
void default_cfg(struct cfg *cfg)
|
||||
{
|
||||
diff --git a/cfgfile.h b/cfgfile.h
|
||||
index dfed8c9..5bb1b2c 100644
|
||||
--- a/cfgfile.h
|
||||
+++ b/cfgfile.h
|
||||
@@ -47,6 +47,7 @@ struct cfg {
|
||||
int devid[MAX_CUSTOM][2]; /* custom USB vendor/product id list */
|
||||
};
|
||||
|
||||
+char* cfg_path(void);
|
||||
void default_cfg(struct cfg *cfg);
|
||||
int read_cfg(const char *fname, struct cfg *cfg);
|
||||
int write_cfg(const char *fname, struct cfg *cfg);
|
||||
diff --git a/front_gtk.c b/front_gtk.c
|
||||
index e4c2cd7..6a800a0 100644
|
||||
--- a/front_gtk.c
|
||||
+++ b/front_gtk.c
|
||||
@@ -28,8 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "cmd.h"
|
||||
#include "ui.h"
|
||||
|
||||
-#define CFGFILE "/etc/spnavrc"
|
||||
-
|
||||
#define CHK_AXINV_TRANS_X "axinv_trans_x"
|
||||
#define CHK_AXINV_TRANS_Y "axinv_trans_y"
|
||||
#define CHK_AXINV_TRANS_Z "axinv_trans_z"
|
||||
@@ -121,7 +119,7 @@ void frontend(int pfd)
|
||||
|
||||
gtk_init(&argc, 0);
|
||||
|
||||
- read_cfg(CFGFILE, &cfg);
|
||||
+ read_cfg(cfg_path(), &cfg);
|
||||
|
||||
create_ui();
|
||||
|
40
pkgs/applications/misc/spnavcfg/configure-pidfile-path.patch
Normal file
40
pkgs/applications/misc/spnavcfg/configure-pidfile-path.patch
Normal file
|
@ -0,0 +1,40 @@
|
|||
diff --git a/back.c b/back.c
|
||||
index f364e31..c1810dc 100644
|
||||
--- a/back.c
|
||||
+++ b/back.c
|
||||
@@ -26,7 +26,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "cmd.h"
|
||||
|
||||
#define CFGFILE "/etc/spnavrc"
|
||||
-#define PIDFILE "/var/run/spnavd.pid"
|
||||
|
||||
int get_daemon_pid(void);
|
||||
static int update_cfg(void);
|
||||
@@ -97,11 +96,26 @@ int get_daemon_pid(void)
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[64];
|
||||
+ char* xdg_runtime_dir;
|
||||
+ char* pidfile;
|
||||
|
||||
- if(!(fp = fopen(PIDFILE, "r"))) {
|
||||
+ if(!(xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"))){
|
||||
+ fprintf(stderr, "XDG_RUNTIME_DIR not set, can't find spacenav pid file\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ pidfile = malloc(strlen(xdg_runtime_dir) + strlen("/spnavd.pid") + 1);
|
||||
+ if (pidfile == NULL) {
|
||||
+ fprintf(stderr, "failed to allocate memory\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ sprintf(pidfile, "%s/spnavd.pid", xdg_runtime_dir);
|
||||
+
|
||||
+ if(!(fp = fopen(pidfile, "r"))) {
|
||||
fprintf(stderr, "no spacenav pid file, can't find daemon\n");
|
||||
+ free(pidfile);
|
||||
return -1;
|
||||
}
|
||||
+ free(pidfile);
|
||||
if(!fgets(buf, sizeof buf, fp) || !isdigit(buf[0])) {
|
||||
fprintf(stderr, "corrupted pidfile, can't find the daemon\n");
|
||||
fclose(fp);
|
|
@ -11,6 +11,15 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "180mkdis15gxs79rr3f7hpwa1p6v81bybw37pzzdjnmqwqrc08a0";
|
||||
};
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
sed -i s/4775/775/ Makefile.in
|
||||
'';
|
||||
|
|
|
@ -28,7 +28,7 @@ let
|
|||
else "");
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "signal-desktop";
|
||||
version = "5.2.0"; # Please backport all updates to the stable channel.
|
||||
version = "5.2.1"; # Please backport all updates to the stable channel.
|
||||
# All releases have a limited lifetime and "expire" 90 days after the release.
|
||||
# When releases "expire" the application becomes unusable until an update is
|
||||
# applied. The expiration date for the current release can be extracted with:
|
||||
|
@ -38,7 +38,7 @@ in stdenv.mkDerivation rec {
|
|||
|
||||
src = fetchurl {
|
||||
url = "https://updates.signal.org/desktop/apt/pool/main/s/signal-desktop/signal-desktop_${version}_amd64.deb";
|
||||
sha256 = "0jvimpmz1d0pg9zpnyzm7a3g7vzapq62cphmvjhh67dxv5jih37k";
|
||||
sha256 = "0hkl8h49565kncvczv5fv4gak55lycygwb8i8igkgc4my0ykzs2z";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
buildGoModule rec {
|
||||
pname = "lab";
|
||||
version = "0.21.0";
|
||||
version = "0.22.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "zaquestion";
|
||||
repo = "lab";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-mkhJmrKpIISd0m0m8fQ9vKuEr6h23BBxK6yo5fB+xcA=";
|
||||
sha256 = "sha256-CyXEmlsc40JtwDjRYNWqN+3cuoG8K07jAQdd1rktvS8=";
|
||||
};
|
||||
|
||||
subPackages = [ "." ];
|
||||
|
||||
vendorSha256 = "sha256-cf+DVnGjSNV2eZ8S/Vk+VPlykoSjngrQuPeA9IshBUg=";
|
||||
vendorSha256 = "sha256-PSS7OPbM+XsylqDlWc4h+oZrOua2kSWKLEuyjqo/cxM=";
|
||||
|
||||
doCheck = false;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
, qtquickcontrols
|
||||
, qtimageformats
|
||||
, qtxmlpatterns
|
||||
, ffmpeg_3
|
||||
, ffmpeg
|
||||
, guvcview
|
||||
, cmake
|
||||
, ninja
|
||||
|
@ -40,7 +40,6 @@ mkDerivation rec {
|
|||
v4l-utils
|
||||
libv4l
|
||||
pcre
|
||||
ffmpeg_3
|
||||
guvcview
|
||||
qwt
|
||||
];
|
||||
|
@ -64,6 +63,10 @@ mkDerivation rec {
|
|||
grep -rl 'qwt' . | xargs sed -i 's@<qwt/qwt_slider.h>@<qwt_slider.h>@g'
|
||||
'';
|
||||
|
||||
qtWrapperArgs = [
|
||||
"--prefix" "PATH" ":" (lib.makeBinPath [ ffmpeg ])
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://www.qstopmotion.org";
|
||||
description = "Create stopmotion animation with a (web)camera";
|
||||
|
|
|
@ -203,6 +203,13 @@ self: super: {
|
|||
sha256 = "0pqmijfkysjixg3gb4kmrqdif7s2saz8qi6k337jf15i0npzln8d";
|
||||
revert = true;
|
||||
})
|
||||
# fix broken location annotations (necessary for update-nix-fetchgit).
|
||||
# Can be removed on the next hnix release after
|
||||
# https://github.com/haskell-nix/hnix/pull/936 is merged.
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://github.com/expipiplus1/hnix/commit/7cd998426ab7d930d288a1d6e266dc4e85cece3d.patch";
|
||||
sha256 = "19ay6vxa90ykgdd0fis2djvki2kpgfsq7z55iyqg965m583vsfr6";
|
||||
})
|
||||
] ++ (drv.patches or []);
|
||||
}));
|
||||
|
||||
|
@ -1405,10 +1412,7 @@ self: super: {
|
|||
}"
|
||||
'';
|
||||
|
||||
# 2021-04-09: test failure
|
||||
# PR pending https://github.com/expipiplus1/update-nix-fetchgit/pull/60
|
||||
doCheck = false;
|
||||
|
||||
# These can both be removed upon the release of update-nix-fetchgit-0.2.7
|
||||
patches = [
|
||||
# 2021-05-17 compile with hnix >= 0.13
|
||||
# https://github.com/expipiplus1/update-nix-fetchgit/pull/64
|
||||
|
@ -1416,6 +1420,12 @@ self: super: {
|
|||
url = "https://github.com/expipiplus1/update-nix-fetchgit/commit/bc28c8b26c38093aa950574802012c0cd8447ce8.patch";
|
||||
sha256 = "1dwd1jdsrx3ss6ql1bk2ch7ln74mkq6jy9ms8vi8kmf3gbg8l9fg";
|
||||
})
|
||||
# Fix test failure
|
||||
# https://github.com/expipiplus1/update-nix-fetchgit/pull/60
|
||||
(pkgs.fetchpatch {
|
||||
url = "https://github.com/expipiplus1/update-nix-fetchgit/commit/4a43e1ea4e7e1c18de81e3f9fe0b86faa70865f5.patch";
|
||||
sha256 = "1z74c1blgwr4q37m1rhlj7534qbnp3nnxf63m8j2b7iz0ljgm0m9";
|
||||
})
|
||||
] ++ (drv.patches or []);
|
||||
}));
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
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) {
|
|
@ -14,6 +14,12 @@ stdenv.mkDerivation rec {
|
|||
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" ];
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = "5.0.1";
|
||||
version = "5.0.2";
|
||||
pname = "xdg";
|
||||
disabled = isPy27;
|
||||
format = "pyproject";
|
||||
|
@ -14,7 +14,7 @@ buildPythonPackage rec {
|
|||
owner = "srstevenson";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-WMY9Hs9SbErTp8hVBoCWTz4dLQhuzqTRpXFEyE7+woo=";
|
||||
sha256 = "sha256-wZfihMrq83Bye5CE5p7bTlI9Z7CsCkSd8Art5ws4vsY=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ poetry-core ];
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "bootstrap";
|
||||
version = "5.0.0";
|
||||
version = "5.0.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/twbs/bootstrap/releases/download/v${version}/${pname}-${version}-dist.zip";
|
||||
sha256 = "sha256-CsPvq8exUL2k/b/QK9c2S68DIsDDR8qxho0WgDJ3/Vs=";
|
||||
sha256 = "sha256-eep9s1YxTHeDDh+WhDMENho/N3AfJHVitis22bIGa6w=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
|
63
pkgs/misc/drivers/spacenavd/configure-cfgfile-path.patch
Normal file
63
pkgs/misc/drivers/spacenavd/configure-cfgfile-path.patch
Normal file
|
@ -0,0 +1,63 @@
|
|||
diff --git a/src/spnavd.c b/src/spnavd.c
|
||||
index 2d4eca6..a5227ed 100644
|
||||
--- a/src/spnavd.c
|
||||
+++ b/src/spnavd.c
|
||||
@@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <pwd.h>
|
||||
#include "spnavd.h"
|
||||
#include "logger.h"
|
||||
#include "dev.h"
|
||||
@@ -47,13 +49,39 @@ static void handle_events(fd_set *rset);
|
||||
static void sig_handler(int s);
|
||||
static char *fix_path(char *str);
|
||||
|
||||
-static char *cfgfile = DEF_CFGFILE;
|
||||
+static char* config_path;
|
||||
+char* cfg_path()
|
||||
+{
|
||||
+ char* buf;
|
||||
+ if((buf = getenv("XDG_CONFIG_HOME"))) {
|
||||
+ if(config_path == NULL) {
|
||||
+ config_path = malloc(strlen(buf) + strlen("/spnavrc") + 1);
|
||||
+ if ( config_path != NULL) {
|
||||
+ sprintf(config_path, "%s/spnavrc", buf);
|
||||
+ }
|
||||
+ };
|
||||
+ return config_path;
|
||||
+ } else {
|
||||
+ if (!(buf = getenv("HOME"))) {
|
||||
+ struct passwd *pw = getpwuid(getuid());
|
||||
+ buf = pw->pw_dir;
|
||||
+ }
|
||||
+ config_path = malloc(strlen(buf) + strlen("/.config/spnavrc") + 1);
|
||||
+ if ( config_path != NULL) {
|
||||
+ sprintf(config_path, "%s/.config/spnavrc", buf);
|
||||
+ }
|
||||
+ return config_path;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static char *cfgfile = NULL;
|
||||
static char *logfile = DEF_LOGFILE;
|
||||
static char *pidpath = NULL;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, pid, ret, become_daemon = 1;
|
||||
+ cfgfile = cfg_path();
|
||||
|
||||
for(i=1; i<argc; i++) {
|
||||
if(argv[i][0] == '-') {
|
||||
@@ -247,7 +275,7 @@ static void print_usage(const char *argv0)
|
||||
printf("usage: %s [options]\n", argv0);
|
||||
printf("options:\n");
|
||||
printf(" -d: do not daemonize\n");
|
||||
- printf(" -c <file>: config file path (default: " DEF_CFGFILE ")\n");
|
||||
+ printf(" -c <file>: config file path (default: %s)\n", cfg_path());
|
||||
printf(" -l <file>|syslog: log file path or log to syslog (default: " DEF_LOGFILE ")\n");
|
||||
printf(" -v: verbose output\n");
|
||||
printf(" -V,-version: print version number and exit\n");
|
82
pkgs/misc/drivers/spacenavd/configure-pidfile-path.patch
Normal file
82
pkgs/misc/drivers/spacenavd/configure-pidfile-path.patch
Normal file
|
@ -0,0 +1,82 @@
|
|||
diff --git a/src/spnavd.c b/src/spnavd.c
|
||||
index 03080da..2d4eca6 100644
|
||||
--- a/src/spnavd.c
|
||||
+++ b/src/spnavd.c
|
||||
@@ -42,12 +42,14 @@ static void cleanup(void);
|
||||
static void daemonize(void);
|
||||
static int write_pid_file(void);
|
||||
static int find_running_daemon(void);
|
||||
+static char *pidfile_path(void);
|
||||
static void handle_events(fd_set *rset);
|
||||
static void sig_handler(int s);
|
||||
static char *fix_path(char *str);
|
||||
|
||||
static char *cfgfile = DEF_CFGFILE;
|
||||
static char *logfile = DEF_LOGFILE;
|
||||
+static char *pidpath = NULL;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@@ -270,7 +272,7 @@ static void cleanup(void)
|
||||
remove_device(tmp);
|
||||
}
|
||||
|
||||
- remove(PIDFILE);
|
||||
+ remove(pidfile_path());
|
||||
}
|
||||
|
||||
static void daemonize(void)
|
||||
@@ -314,7 +316,7 @@ static int write_pid_file(void)
|
||||
FILE *fp;
|
||||
int pid = getpid();
|
||||
|
||||
- if(!(fp = fopen(PIDFILE, "w"))) {
|
||||
+ if(!(fp = fopen(pidfile_path(), "w"))) {
|
||||
return -1;
|
||||
}
|
||||
fprintf(fp, "%d\n", pid);
|
||||
@@ -329,7 +331,7 @@ static int find_running_daemon(void)
|
||||
struct sockaddr_un addr;
|
||||
|
||||
/* try to open the pid-file */
|
||||
- if(!(fp = fopen(PIDFILE, "r"))) {
|
||||
+ if(!(fp = fopen(pidfile_path(), "r"))) {
|
||||
return -1;
|
||||
}
|
||||
if(fscanf(fp, "%d\n", &pid) != 1) {
|
||||
@@ -356,6 +358,22 @@ static int find_running_daemon(void)
|
||||
return pid;
|
||||
}
|
||||
|
||||
+char *pidfile_path(void)
|
||||
+{
|
||||
+ char *xdg_runtime_dir;
|
||||
+ if((xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"))) {
|
||||
+ if ( pidpath == NULL ) {
|
||||
+ pidpath = malloc(strlen(xdg_runtime_dir) + strlen("/spnavd.pid") + 1);
|
||||
+ if ( pidpath != NULL ) {
|
||||
+ sprintf(pidpath, "%s/spnavd.pid", xdg_runtime_dir);
|
||||
+ }
|
||||
+ };
|
||||
+ return pidpath;
|
||||
+ } else {
|
||||
+ return DEFAULT_PIDFILE;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void handle_events(fd_set *rset)
|
||||
{
|
||||
int dev_fd, hotplug_fd;
|
||||
diff --git a/src/spnavd.h b/src/spnavd.h
|
||||
index 2d1c48b..17d22d3 100644
|
||||
--- a/src/spnavd.h
|
||||
+++ b/src/spnavd.h
|
||||
@@ -26,7 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DEF_CFGFILE "/etc/spnavrc"
|
||||
#define DEF_LOGFILE "/var/log/spnavd.log"
|
||||
|
||||
-#define PIDFILE "/var/run/spnavd.pid"
|
||||
+#define DEFAULT_PIDFILE "/run/spnavd.pid"
|
||||
#define DEFAULT_SOCK_NAME "/run/spnav.sock"
|
||||
#define SYSLOG_ID "spnavd"
|
||||
|
118
pkgs/misc/drivers/spacenavd/configure-socket-path.patch
Normal file
118
pkgs/misc/drivers/spacenavd/configure-socket-path.patch
Normal file
|
@ -0,0 +1,118 @@
|
|||
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 <http://www.gnu.org/licenses/>.
|
||||
#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..2d1c48b 100644
|
||||
--- a/src/spnavd.h
|
||||
+++ b/src/spnavd.h
|
||||
@@ -26,8 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define DEF_CFGFILE "/etc/spnavrc"
|
||||
#define DEF_LOGFILE "/var/log/spnavd.log"
|
||||
|
||||
-#define SOCK_NAME "/var/run/spnav.sock"
|
||||
#define PIDFILE "/var/run/spnavd.pid"
|
||||
+#define DEFAULT_SOCK_NAME "/run/spnav.sock"
|
||||
#define SYSLOG_ID "spnavd"
|
||||
|
||||
/* Multiple devices support */
|
|
@ -17,6 +17,15 @@ stdenv.mkDerivation rec {
|
|||
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 ]
|
||||
|
|
29
pkgs/tools/misc/fetchutils/default.nix
Normal file
29
pkgs/tools/misc/fetchutils/default.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{ lib, stdenvNoCC, fetchFromGitHub, bash, scdoc }:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "fetchutils";
|
||||
version = "unstable-2021-03-16";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "lptstr";
|
||||
repo = pname;
|
||||
rev = "882781a297e86f4ad4eaf143e0777fb3e7c69526";
|
||||
sha256 = "sha256-ONrVZC6GBV5v3TeBekW9ybZjDHF3FNyXw1rYknqKRbk=";
|
||||
};
|
||||
|
||||
buildInputs = [ bash scdoc ];
|
||||
|
||||
installFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs --host src/*
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A collection of small shell utilities to fetch system information";
|
||||
homepage = "https://github.com/lptstr/fetchutils";
|
||||
license = licenses.mit;
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ fortuneteller2k ];
|
||||
};
|
||||
}
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nixos-generators";
|
||||
version = "1.2.0";
|
||||
version = "1.3.0";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = "nixos-generators";
|
||||
rev = version;
|
||||
sha256 = "1iwc39hzvzzyndxwbnl3fck7phxnjpnhy8zn4nyp8is1fiw0648v";
|
||||
sha256 = "1gbj2jw7zv3mnq1lyj4q53jpfj642jy7lvg0kp060znvhws3370y";
|
||||
};
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
|
|
|
@ -407,6 +407,8 @@ in
|
|||
|
||||
etBook = callPackage ../data/fonts/et-book { };
|
||||
|
||||
fetchutils = callPackage ../tools/misc/fetchutils { };
|
||||
|
||||
fet-sh = callPackage ../tools/misc/fet-sh { };
|
||||
|
||||
fetchbower = callPackage ../build-support/fetchbower {
|
||||
|
@ -23639,6 +23641,7 @@ in
|
|||
boost
|
||||
matplotlib
|
||||
pivy
|
||||
ply
|
||||
pycollada
|
||||
pyside2
|
||||
pyside2-tools
|
||||
|
@ -26155,7 +26158,7 @@ in
|
|||
rofi-systemd = callPackage ../tools/system/rofi-systemd { };
|
||||
|
||||
rofimoji = callPackage ../applications/misc/rofimoji {
|
||||
inherit (python3Packages) buildPythonApplication ConfigArgParse pyxdg;
|
||||
inherit (python3Packages) buildPythonApplication ConfigArgParse;
|
||||
};
|
||||
|
||||
rootlesskit = callPackage ../tools/virtualization/rootlesskit {};
|
||||
|
|
Loading…
Reference in a new issue