push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
{
lib,
buildGoModule,
fetchFromGitHub,
versionCheckHook,
nix-update-script,
}:
buildGoModule rec {
pname = "usacloud";
version = "1.16.1";
src = fetchFromGitHub {
owner = "sacloud";
repo = "usacloud";
tag = "v${version}";
hash = "sha256-+aFtj9sJIiBakWcOA4hJ9yoPPBsKC+3xCWFNAXNVGQQ=";
};
vendorHash = "sha256-MWemCBnMtPnVK5ZXLtJdymWVTnYRXr8EkK08Atdi1Nc=";
ldflags = [
"-s"
"-w"
"-X=github.com/sacloud/usacloud/pkg/version.Revision=${src.rev}"
];
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru.updateScript = nix-update-script { };
meta = {
description = "CLI client for the Sakura Cloud";
homepage = "https://github.com/sacloud/usacloud";
changelog = "https://github.com/sacloud/usacloud/releases/tag/v${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ natsukium ];
mainProgram = "usacloud";
};
}

View File

@@ -0,0 +1,52 @@
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
installShellFiles,
nix-update-script,
usage,
testers,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "usage";
version = "2.2.2";
src = fetchFromGitHub {
owner = "jdx";
repo = "usage";
tag = "v${finalAttrs.version}";
hash = "sha256-Hnq3ViMrNIo9m/1mePjEzMv87U24wY50UiYxnpJqHR8=";
};
cargoHash = "sha256-Zj8Z88gYx+i0VN14HbO1LSlWjZX1EvrtyKvAwpnFMgs=";
postPatch = ''
substituteInPlace ./examples/mounted.sh \
--replace-fail '/usr/bin/env -S usage' "$(pwd)/target/${stdenv.targetPlatform.rust.rustcTargetSpec}/release/usage"
'';
nativeBuildInputs = [ installShellFiles ];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd usage \
--bash <($out/bin/usage --completions bash) \
--fish <($out/bin/usage --completions fish) \
--zsh <($out/bin/usage --completions zsh)
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion { package = usage; };
};
meta = {
homepage = "https://usage.jdx.dev";
description = "Specification for CLIs";
changelog = "https://github.com/jdx/usage/releases/tag/v${finalAttrs.version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ konradmalik ];
mainProgram = "usage";
};
})

View File

@@ -0,0 +1,36 @@
{
lib,
stdenvNoCC,
udevCheckHook,
}:
stdenvNoCC.mkDerivation rec {
name = "usb-blaster-udev-rules";
udevRules = ./usb-blaster.rules;
dontUnpack = true;
nativeBuildInputs = [
udevCheckHook
];
doInstallCheck = true;
installPhase = ''
install -Dm 644 "${udevRules}" "$out/lib/udev/rules.d/51-usbblaster.rules"
'';
meta = with lib; {
description = "udev rules that give NixOS permission to communicate with usb blasters";
longDescription = ''
udev rules that give NixOS permission to communicate with usb blasters.
To use it under NixOS, add
services.udev.packages = [ pkgs.usb-blaster-udev-rules ];
to the system configuration.
'';
license = licenses.free;
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,8 @@
# USB-Blaster
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", TAG+="uaccess"
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6002", TAG+="uaccess"
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6003", TAG+="uaccess"
# USB-Blaster II
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6010", TAG+="uaccess"
ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6810", TAG+="uaccess"

View File

@@ -0,0 +1,283 @@
Index: usb-modeswitch-2.6.0/Makefile
===================================================================
--- usb-modeswitch-2.6.0.orig/Makefile
+++ usb-modeswitch-2.6.0/Makefile
@@ -5,17 +5,24 @@ CFLAGS += -Wall -Wno-deprecated-dec
LIBS = `pkg-config --libs --cflags libusb-1.0`
RM = /bin/rm -f
OBJS = usb_modeswitch.c
-PREFIX = $(DESTDIR)/usr
-ETCDIR = $(DESTDIR)/etc
+PREFIX = /usr/local
+ETCDIR = $(PREFIX)/etc
SYSDIR = $(ETCDIR)/systemd/system
UPSDIR = $(ETCDIR)/init
-UDEVDIR = $(DESTDIR)/lib/udev
+UDEVDIR = $(PREFIX)/lib/udev
SBINDIR = $(PREFIX)/sbin
MANDIR = $(PREFIX)/share/man/man1
+USE_UPSTART=$(shell if command -v initctl > /dev/null; then echo "true"; fi)
+USE_SYSTEMD=$(shell if command -v systemctl > /dev/null; then echo "true"; fi)
+
.PHONY: clean install install-common uninstall \
dispatcher-script dispatcher-dynlink dispatcher-statlink \
- install-script install-dynlink install-statlink
+ install-script install-dynlink install-statlink \
+ install-upstart install-systemd \
+ configure-dispatcher configure-script \
+ configure-upstart configure-systemd \
+ configure
all: all-with-script-dispatcher
@@ -28,7 +35,25 @@ all-with-statlink-dispatcher: $(PROG) di
$(PROG): $(OBJS) usb_modeswitch.h
$(CC) -o $(PROG) $(OBJS) $(CFLAGS) $(LIBS) $(LDFLAGS)
-dispatcher-script: usb_modeswitch_dispatcher.tcl
+configure-dispatcher:
+ sed -i \
+ -e 's,^\(set setup(sbindir) \).*$$,\1$(SBINDIR),' \
+ -e 's,^\(set setup(etcdir) \).*$$,\1$(ETCDIR),' \
+ usb_modeswitch_dispatcher.tcl
+
+configure-script:
+ sed -i -e 's,^\(SBINDIR=\).*$$,\1$(SBINDIR),' usb_modeswitch.sh
+
+configure-systemd:
+ sed -i -e 's,@sbindir@,$(SBINDIR),' usb_modeswitch@.service
+
+configure-upstart:
+ sed -i -e 's,@sbindir@,$(SBINDIR),' usb-modeswitch-upstart.conf
+
+configure: configure-dispatcher configure-script \
+ configure-systemd configure-upstart
+
+dispatcher-script: configure-dispatcher usb_modeswitch_dispatcher.tcl
DISPATCH=dispatcher-script
cp -f usb_modeswitch_dispatcher.tcl usb_modeswitch_dispatcher
@@ -53,16 +78,28 @@ distclean: clean
# If the systemd folder is present, install the service for starting the dispatcher
# If not, use the dispatcher directly from the udev rule as in previous versions
-install-common: $(PROG) $(DISPATCH)
- install -D --mode=755 usb_modeswitch $(SBINDIR)/usb_modeswitch
- install -D --mode=755 usb_modeswitch.sh $(UDEVDIR)/usb_modeswitch
- install -D --mode=644 usb_modeswitch.conf $(ETCDIR)/usb_modeswitch.conf
- install -D --mode=644 usb_modeswitch.1 $(MANDIR)/usb_modeswitch.1
- install -D --mode=644 usb_modeswitch_dispatcher.1 $(MANDIR)/usb_modeswitch_dispatcher.1
- install -D --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
+install-common: $(PROG) configure $(DISPATCH)
+ install -D --mode=755 usb_modeswitch $(DESTDIR)$(SBINDIR)/usb_modeswitch
+ install -D --mode=755 usb_modeswitch.sh $(DESTDIR)$(UDEVDIR)/usb_modeswitch
+ install -D --mode=644 usb_modeswitch.conf $(DESTDIR)$(ETCDIR)/usb_modeswitch.conf
+ install -D --mode=644 usb_modeswitch.1 $(DESTDIR)$(MANDIR)/usb_modeswitch.1
+ install -D --mode=644 usb_modeswitch_dispatcher.1 $(DESTDIR)$(MANDIR)/usb_modeswitch_dispatcher.1
+ install -D --mode=755 usb_modeswitch_dispatcher $(DESTDIR)$(SBINDIR)/usb_modeswitch_dispatcher
install -d $(DESTDIR)/var/lib/usb_modeswitch
- test -d $(UPSDIR) -a -e /sbin/initctl && install --mode=644 usb-modeswitch-upstart.conf $(UPSDIR) || test 1
- test -d $(SYSDIR) -a \( -e /usr/bin/systemctl -o -e /bin/systemctl \) && install --mode=644 usb_modeswitch@.service $(SYSDIR) || test 1
+
+install-upstart:
+ install -D --mode=644 usb-modeswitch-upstart.conf $(DESTDIR)$(UPSDIR)/usb-modeswitch-upstart.conf
+
+install-systemd:
+ install -D --mode=644 usb_modeswitch@.service $(DESTDIR)$(SYSDIR)/usb_modeswitch@.service
+
+ifeq ($(USE_UPSTART),true)
+install-common: install-upstart
+endif
+
+ifeq ($(USE_SYSTEMD),true)
+install-common: install-systemd
+endif
install: install-script
@@ -73,10 +110,10 @@ install-dynlink: dispatcher-dynlink inst
install-statlink: dispatcher-statlink install-common
uninstall:
- $(RM) $(SBINDIR)/usb_modeswitch
- $(RM) $(SBINDIR)/usb_modeswitch_dispatcher
- $(RM) $(UDEVDIR)/usb_modeswitch
- $(RM) $(ETCDIR)/usb_modeswitch.conf
- $(RM) $(MANDIR)/usb_modeswitch.1
+ $(RM) $(DESTDIR)$(SBINDIR)/usb_modeswitch
+ $(RM) $(DESTDIR)$(SBINDIR)/usb_modeswitch_dispatcher
+ $(RM) $(DESTDIR)$(UDEVDIR)/usb_modeswitch
+ $(RM) $(DESTDIR)$(ETCDIR)/usb_modeswitch.conf
+ $(RM) $(DESTDIR)$(MANDIR)/usb_modeswitch.1
$(RM) -R $(DESTDIR)/var/lib/usb_modeswitch
- $(RM) $(SYSDIR)/usb_modeswitch@.service
+ $(RM) $(DESTDIR)$(SYSDIR)/usb_modeswitch@.service
Index: usb-modeswitch-2.6.0/usb-modeswitch-upstart.conf
===================================================================
--- usb-modeswitch-2.6.0.orig/usb-modeswitch-upstart.conf
+++ usb-modeswitch-2.6.0/usb-modeswitch-upstart.conf
@@ -1,5 +1,5 @@
start on usb-modeswitch-upstart
task
script
- exec /usr/sbin/usb_modeswitch_dispatcher --switch-mode $UMS_PARAM
+ exec @sbindir@/usb_modeswitch_dispatcher --switch-mode $UMS_PARAM
end script
Index: usb-modeswitch-2.6.0/usb_modeswitch.sh
===================================================================
--- usb-modeswitch-2.6.0.orig/usb_modeswitch.sh
+++ usb-modeswitch-2.6.0/usb_modeswitch.sh
@@ -1,5 +1,9 @@
#!/bin/sh
# part of usb_modeswitch 2.6.0
+
+# Compile time configuration, injected by the Makefile
+SBINDIR=/usr/sbin
+
device_in()
{
if [ ! -e /var/lib/usb_modeswitch/$1 ]; then
@@ -37,7 +41,7 @@ if [ $(expr "$1" : "--.*") ]; then
v_id=$3
fi
fi
-PATH=/sbin:/usr/sbin:$PATH
+
case "$1" in
--driver-bind)
# driver binding code removed
@@ -46,9 +50,7 @@ case "$1" in
--symlink-name)
device_in "link_list" $v_id $p_id
if [ "$?" = "1" ]; then
- if [ -e "/usr/sbin/usb_modeswitch_dispatcher" ]; then
- exec usb_modeswitch_dispatcher $1 $2 2>>/dev/null
- fi
+ exec $SBINDIR/usb_modeswitch_dispatcher $1 $2 2>>/dev/null
fi
exit 0
;;
@@ -61,15 +63,13 @@ if [ "$p2" = "" -a "$p1" != "" ]; then
p2=$p1
fi
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-init_path=`readlink -f /sbin/init`
-if [ `basename $init_path` = "systemd" ]; then
+if command -v systemctl > /dev/null; then
systemctl --no-block restart usb_modeswitch@$p2.service
-elif [ -e "/etc/init/usb-modeswitch-upstart.conf" ]; then
+elif command -v initctl > /dev/null; then
initctl emit --no-wait usb-modeswitch-upstart UMS_PARAM=$p2
else
# only old distros, new udev will kill all subprocesses
exec 1<&- 2<&- 5<&- 7<&-
- exec usb_modeswitch_dispatcher --switch-mode $p2 &
+ exec $SBINDIR/usb_modeswitch_dispatcher --switch-mode $p2 &
fi
exit 0
Index: usb-modeswitch-2.6.0/usb_modeswitch@.service
===================================================================
--- usb-modeswitch-2.6.0.orig/usb_modeswitch@.service
+++ usb-modeswitch-2.6.0/usb_modeswitch@.service
@@ -3,6 +3,6 @@ Description=USB_ModeSwitch_%i
[Service]
Type=oneshot
-ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode %i
+ExecStart=@sbindir@/usb_modeswitch_dispatcher --switch-mode %i
#ExecStart=/bin/echo %i
Index: usb-modeswitch-2.6.0/usb_modeswitch_dispatcher.tcl
===================================================================
--- usb-modeswitch-2.6.0.orig/usb_modeswitch_dispatcher.tcl
+++ usb-modeswitch-2.6.0/usb_modeswitch_dispatcher.tcl
@@ -12,6 +12,16 @@
# Part of usb-modeswitch-2.6.0 package
# (C) Josua Dietze 2009-2019
+# Compile-time configuration, injected by the Makefile.
+set setup(sbindir) /usr/sbin
+set setup(etcdir) /etc
+
+# External dependency default location
+set setup(dbdir) /usr/share/usb_modeswitch
+
+# Derived configuration
+set setup(dbdir_etc) $setup(etcdir)/usb_modeswitch.d
+
set arg0 [lindex $argv 0]
if [regexp {\.tcl$} $arg0] {
if [file exists $arg0] {
@@ -115,10 +125,8 @@ if {![regexp {(.*?):.*$} $arg1 d device]
}
}
-set setup(dbdir) /usr/share/usb_modeswitch
-set setup(dbdir_etc) /etc/usb_modeswitch.d
if {![file exists $setup(dbdir)] && ![file exists $setup(dbdir_etc)]} {
- Log "\nError: no config database found in /usr/share or /etc. Exit"
+ Log "\nError: no config database found in $setup(dbdir) or $setup(dbdir_etc). Exit"
SafeExit
}
@@ -285,7 +293,7 @@ if {$config(NoMBIMCheck)==0 && $usb(bNum
if [CheckMBIM] {
Log " driver for MBIM devices is available"
Log "Find MBIM configuration number ..."
- if [catch {set cfgno [exec /usr/sbin/usb_modeswitch -j -Q $busParam $devParam -v $usb(idVendor) -p $usb(idProduct)]} err] {
+ if [catch {set cfgno [exec $setup(sbindir)/usb_modeswitch -j -Q $busParam $devParam -v $usb(idVendor) -p $usb(idProduct)]} err] {
Log "Error when trying to find MBIM configuration, switch to legacy modem mode"
} else {
set cfgno [string trim $cfgno]
@@ -321,7 +329,7 @@ if {$report == ""} {
# Now we are actually switching
if $flags(logging) {
Log "Command line:\nusb_modeswitch -W -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f \$flags(config)"
- catch {set report [exec /usr/sbin/usb_modeswitch -W -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]} report
+ catch {set report [exec $setup(sbindir)/usb_modeswitch -W -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]} report
Log "\nVerbose debug output of usb_modeswitch and libusb follows"
Log "(Note that some USB errors are to be expected in the process)"
Log "--------------------------------"
@@ -329,7 +337,7 @@ if {$report == ""} {
Log "--------------------------------"
Log "(end of usb_modeswitch output)\n"
} else {
- catch {set report [exec /usr/sbin/usb_modeswitch -Q -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]} report
+ catch {set report [exec $setup(sbindir)/usb_modeswitch -Q -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]} report
}
}
@@ -522,12 +530,12 @@ return 1
proc {ParseGlobalConfig} {path} {
-global flags
+global flags setup
set configFile ""
if [string length $path] {
set places [list $path]
} else {
- set places [list /etc/usb_modeswitch.conf /etc/sysconfig/usb_modeswitch /etc/default/usb_modeswitch]
+ set places [list $setup(etcdir)/usb_modeswitch.conf $setup(etcdir)/sysconfig/usb_modeswitch $setup(etcdir)/default/usb_modeswitch]
}
foreach cfg $places {
if [file exists $cfg] {
@@ -923,10 +931,12 @@ proc {SysLog} {msg} {
global flags
if {![info exists flags(logger)]} {
- set flags(logger) ""
- foreach fn {/bin/logger /usr/bin/logger} {
- if [file exists $fn] {
- set flags(logger) $fn
+ set flags(logger) [exec sh -c "command -v logger || true"]
+ if {$flags(logger) == ""} {
+ foreach fn {/bin/logger /usr/bin/logger} {
+ if [file exists $fn] {
+ set flags(logger) $fn
+ }
}
}
Log "Logger is $flags(logger)"

View File

@@ -0,0 +1,47 @@
{
lib,
stdenv,
fetchurl,
tcl,
usb-modeswitch,
udevCheckHook,
}:
stdenv.mkDerivation rec {
pname = "usb-modeswitch-data";
version = "20191128";
src = fetchurl {
url = "http://www.draisberghof.de/usb_modeswitch/${pname}-${version}.tar.bz2";
sha256 = "1ygahl3r26r38ai8yyblq9nhf3v5i6n6r6672p5wf88wg5h9n0rz";
};
doInstallCheck = true;
makeFlags = [
"PREFIX=$(out)"
"DESTDIR=$(out)"
];
postPatch =
# bash
''
substituteInPlace 40-usb_modeswitch.rules \
--replace-fail "usb_modeswitch" "${usb-modeswitch}/lib/udev/usb_modeswitch"
# Fix issue reported by udevadm verify
sed -i 's/,,/,/g' 40-usb_modeswitch.rules
'';
# we add tcl here so we can patch in support for new devices by dropping config into
# the usb_modeswitch.d directory
nativeBuildInputs = [
tcl
udevCheckHook
];
meta = {
description = "Device database and the rules file for 'multi-mode' USB devices";
inherit (usb-modeswitch.meta) license maintainers platforms;
};
}

View File

@@ -0,0 +1,75 @@
{
stdenv,
lib,
fetchurl,
pkg-config,
makeWrapper,
libusb1,
tcl,
util-linux,
coreutils,
bash,
}:
stdenv.mkDerivation rec {
pname = "usb-modeswitch";
version = "2.6.0";
src = fetchurl {
url = "http://www.draisberghof.de/usb_modeswitch/${pname}-${version}.tar.bz2";
sha256 = "18wbbxc5cfsmikba0msdvd5qlaga27b32nhrzicyd9mdddp265f2";
};
patches = [
./configurable-usb-modeswitch.patch
./pkg-config.patch
];
# Remove attempts to write to /etc and /var/lib.
postPatch = ''
sed -i \
-e '/^\tinstall .* usb_modeswitch.conf/s,$(ETCDIR),$(out)/etc,' \
-e '\,^\tinstall -d .*/var/lib/usb_modeswitch,d' \
Makefile
'';
makeFlags = [
"PREFIX=$(out)"
"ETCDIR=/etc"
"USE_UPSTART=false"
"USE_SYSTEMD=true"
"SYSDIR=$(out)/lib/systemd/system"
"UDEVDIR=$(out)/lib/udev"
];
postFixup = ''
wrapProgram $out/bin/usb_modeswitch_dispatcher \
--set PATH ${
lib.makeBinPath [
util-linux
coreutils
bash
]
}
'';
buildInputs = [
libusb1
tcl
];
nativeBuildInputs = [
pkg-config
makeWrapper
];
meta = with lib; {
description = "Mode switching tool for controlling 'multi-mode' USB devices";
license = licenses.gpl2;
maintainers = with maintainers; [
marcweber
peterhoeg
];
platforms = platforms.linux;
mainProgram = "usb_modeswitch";
};
}

View File

@@ -0,0 +1,14 @@
diff --git a/Makefile b/Makefile
index 9aa7356..c5f2a87 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,8 @@ PROG = usb_modeswitch
VERS = 2.6.0
CC ?= gcc
CFLAGS += -Wall -Wno-deprecated-declarations
-LIBS = `pkg-config --libs --cflags libusb-1.0`
+PKG_CONFIG ?= pkg-config
+LIBS = `$(PKG_CONFIG) --libs --cflags libusb-1.0`
RM = /bin/rm -f
OBJS = usb_modeswitch.c
PREFIX = $(DESTDIR)/usr

View File

@@ -0,0 +1,44 @@
{
lib,
stdenv,
fetchFromGitHub,
libusb1,
}:
stdenv.mkDerivation {
pname = "usb-reset";
# not tagged, but changelog has this with the date of the e9a9d6c commit
# and no significant change occurred between bumping the version in the Makefile and that
# and the changes since then (up to ff822d8) seem snap related
version = "0.3";
src = fetchFromGitHub {
owner = "ralight";
repo = "usb-reset";
rev = "e9a9d6c4a533430e763e111a349efbba69e7a5bb";
sha256 = "0k9qmhqi206gcnv3z4vwya82g5nm225972ylf67zjiikk8pn8m0s";
};
buildInputs = [ libusb1 ];
postPatch = ''
substituteInPlace Makefile \
--replace /usr/include/libusb-1.0 ${libusb1.dev}/include/libusb-1.0
'';
makeFlags = [
"DESTDIR=${placeholder "out"}"
"prefix="
];
meta = with lib; {
broken = stdenv.hostPlatform.isDarwin;
description = "Perform a bus reset on a USB device using its vendor and product ID";
homepage = "https://github.com/ralight/usb-reset";
changelog = "https://github.com/ralight/usb-reset/blob/master/ChangeLog.txt";
license = licenses.mit;
maintainers = [ ];
platforms = platforms.all;
mainProgram = "usb-reset";
};
}

View File

@@ -0,0 +1,52 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
libimobiledevice,
libusb1,
libusbmuxd,
usbmuxd,
libplist,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "usbfluxd";
version = "1.0";
src = fetchFromGitHub {
owner = "corellium";
repo = "usbfluxd";
tag = "v${finalAttrs.version}";
hash = "sha256-tfAy3e2UssPlRB/8uReLS5f8N/xUUzbjs8sKNlr40T0=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
buildInputs = [
libimobiledevice
libusb1
libusbmuxd
usbmuxd
libplist
];
postPatch = ''
substituteInPlace configure.ac \
--replace-fail 'with_static_libplist=yes' 'with_static_libplist=no'
substituteInPlace usbfluxd/utils.h \
--replace-fail PLIST_FORMAT_BINARY //PLIST_FORMAT_BINARY \
--replace-fail PLIST_FORMAT_XML, NOT_PLIST_FORMAT_XML
'';
meta = {
homepage = "https://github.com/corellium/usbfluxd";
description = "Redirects the standard usbmuxd socket to allow connections to local and remote usbmuxd instances so remote devices appear connected locally";
license = lib.licenses.gpl2Plus;
mainProgram = "usbfluxctl";
maintainers = with lib.maintainers; [ x807x ];
};
})

View File

@@ -0,0 +1,55 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
libqb,
usbguard,
librsvg,
libnotify,
catch2,
asciidoc,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "usbguard-notifier";
version = "0.1.1";
src = fetchFromGitHub {
owner = "Cropi";
repo = "usbguard-notifier";
tag = "usbguard-notifier-${finalAttrs.version}";
hash = "sha256-EP+NUzT5nu7rJeSEyxs/JARVx7jH2Vip73ksmQw+ABM=";
};
postPatch = ''
substituteInPlace configure.ac \
--replace-fail 'AC_MSG_FAILURE([Cannot detect the systemd system unit dir])' \
'systemd_unit_dir="$out/lib/systemd/user"'
'';
nativeBuildInputs = [
autoreconfHook
pkg-config
asciidoc
];
buildInputs = [
libqb
usbguard
librsvg
libnotify
];
configureFlags = [ "CPPFLAGS=-I${catch2}/include/catch2" ];
meta = {
description = "Notifications for detecting usbguard policy and device presence changes";
homepage = "https://github.com/Cropi/usbguard-notifier";
maintainers = with lib.maintainers; [ fpletz ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl2Plus;
mainProgram = "usbguard-notifier";
};
})

View File

@@ -0,0 +1,90 @@
{
stdenv,
lib,
fetchFromGitHub,
autoreconfHook,
installShellFiles,
nixosTests,
asciidoc,
pkg-config,
libxslt,
libxml2,
docbook_xml_dtd_45,
docbook_xsl,
dbus-glib,
libcap_ng,
libqb,
libseccomp,
polkit,
protobuf,
audit,
libsodium,
}:
stdenv.mkDerivation (finalAttrs: {
version = "1.1.4";
pname = "usbguard";
src = fetchFromGitHub {
owner = "USBGuard";
repo = "usbguard";
tag = "usbguard-${finalAttrs.version}";
hash = "sha256-PDuYszdG6BK4fkAHWWBct1d7tnwwe+5XOw+xmSPoPCY=";
fetchSubmodules = true;
};
nativeBuildInputs = [
autoreconfHook
installShellFiles
asciidoc
pkg-config
libxslt # xsltproc
libxml2 # xmllint
docbook_xml_dtd_45
docbook_xsl
dbus-glib # gdbus-codegen
protobuf # protoc
];
buildInputs = [
dbus-glib
libcap_ng
libqb
libseccomp
libsodium
polkit
protobuf
audit
];
configureFlags = [
"--with-bundled-catch"
"--with-bundled-pegtl"
"--with-dbus"
"--with-crypto-library=sodium"
"--with-polkit"
];
enableParallelBuilding = true;
postInstall = ''
installShellCompletion --bash --name usbguard.bash scripts/bash_completion/usbguard
installShellCompletion --zsh --name _usbguard scripts/usbguard-zsh-completion
'';
passthru.tests = nixosTests.usbguard;
meta = {
description = "Protect your computer against rogue USB devices (a.k.a. BadUSB)";
longDescription = ''
USBGuard is a software framework for implementing USB device authorization
policies (what kind of USB devices are authorized) as well as method of
use policies (how a USB device may interact with the system). Simply put,
it is a USB device allowlisting tool.
'';
homepage = "https://usbguard.github.io/";
license = lib.licenses.gpl2Plus;
platforms = lib.platforms.linux;
maintainers = [ lib.maintainers.tnias ];
};
})

View File

@@ -0,0 +1,73 @@
{
lib,
stdenv,
fetchFromGitLab,
pkg-config,
wrapGAppsHook3,
withLibui ? true,
gtk3,
withUdisks ? stdenv.hostPlatform.isLinux,
udisks,
glib,
libX11,
}:
stdenv.mkDerivation rec {
pname = "usbimager";
version = "1.0.10";
src = fetchFromGitLab {
owner = "bztsrc";
repo = "usbimager";
rev = version;
hash = "sha256-HTFopc2xrhp0XYubQtOwMKWTQ+3JSKAyL4mMyQ82kAs=";
};
sourceRoot = "${src.name}/src";
nativeBuildInputs = [
pkg-config
wrapGAppsHook3
];
buildInputs =
lib.optionals withUdisks [
udisks
glib
]
++ lib.optional (!withLibui) libX11
++ lib.optional withLibui gtk3;
# libui is bundled with the source of usbimager as a compiled static library
postPatch = ''
sed -i \
-e 's|install -m 2755 -g disk|install |g' \
-e 's|-I/usr/include/gio-unix-2.0|-I${glib.dev}/include/gio-unix-2.0|g' \
-e 's|install -m 2755 -g $(GRP)|install |g' Makefile
'';
postInstall = ''
substituteInPlace $out/share/applications/usbimager.desktop \
--replace-fail "Exec=/usr/bin/usbimager" "Exec=usbimager"
'';
dontConfigure = true;
makeFlags = [
"PREFIX=$(out)"
]
++ lib.optional withLibui "USE_LIBUI=yes"
++ lib.optional withUdisks "USE_UDISKS2=yes";
meta = with lib; {
description = "Very minimal GUI app that can write compressed disk images to USB drives";
homepage = "https://gitlab.com/bztsrc/usbimager";
license = licenses.mit;
maintainers = with maintainers; [ vdot0x23 ];
# windows and darwin could work, but untested
# feel free add them if you have a machine to test
platforms = with platforms; linux;
# never built on aarch64-linux since first introduction in nixpkgs
broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
mainProgram = "usbimager";
};
}

View File

@@ -0,0 +1,54 @@
{
stdenv,
lib,
fetchFromGitHub,
perl,
openssh,
kmod,
makeWrapper,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "usbip-ssh";
version = "0-unstable-2024-10-09";
src = fetchFromGitHub {
owner = "turistu";
repo = "usbip-ssh";
rev = "1b38f2d7854048bf6129ffe992f3c9caa630e377";
hash = "sha256-3kGGMlIMTXnBVLgsZijc0yLbyaZZSDf7lr46mg0viWw=";
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
perl
];
installPhase = ''
runHook preInstall
install -Dm755 usbip-ssh -t $out/bin
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/usbip-ssh --prefix PATH : ${
lib.makeBinPath [
perl
openssh
kmod
]
}
'';
meta = {
homepage = "https://github.com/turistu/usbip-ssh";
description = "Import usb devices from another linux machine with ssh's connection forwarding mechanism";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ kagehisa ];
mainProgram = "usbip-ssh";
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,114 @@
{
lib,
stdenv,
buildGoModule,
fetchzip,
gst_all_1,
gtkmm3,
hidapi,
makeWrapper,
meson,
ninja,
pkg-config,
python3,
udev,
udevCheckHook,
wrapGAppsHook3,
}:
let
version = "0.3.0";
src = fetchzip {
url = "https://github.com/carrotIndustries/usbkvm/releases/download/v${version}/usbkvm-v${version}.tar.gz";
hash = "sha256-urexPODXU69QfSRHtJVpoDx/6mbPcv6EQ3mR0VRHNiY=";
};
ms-tools-lib = buildGoModule {
pname = "usbkvm-ms-tools-lib";
inherit version src;
sourceRoot = "${src.name}/ms-tools";
vendorHash = null; # dependencies are vendored in the release tarball
buildInputs = [ hidapi ];
buildPhase = ''
runHook preBuild
mkdir -p $out/
go build -C lib/ -o $out/ -buildmode=c-archive mslib.go
runHook postBuild
'';
meta = {
homepage = "https://github.com/carrotIndustries/ms-tools";
description = "Program, library and reference designs to develop for MacroSilicon MS2106/MS2109/MS2130 chips";
license = lib.licenses.mit;
};
};
in
stdenv.mkDerivation {
pname = "usbkvm";
inherit version src;
# The package includes instructions to build the "mslib.{a,h}" files using a
# Go compiler, but that doesn't work in the Nix sandbox. We patch out this
# build step to instead copy those files from the Nix store:
patches = [
./precompiled-mslib.patch
];
postPatch = ''
substituteInPlace meson.build \
--replace-fail "@MSLIB_A_PRECOMPILED@" "${ms-tools-lib}/mslib.a" \
--replace-fail "@MSLIB_H_PRECOMPILED@" "${ms-tools-lib}/mslib.h"
'';
nativeBuildInputs = [
pkg-config
python3
meson
ninja
makeWrapper
wrapGAppsHook3
udev
udevCheckHook
];
buildInputs = [
gst_all_1.gstreamer
gtkmm3
hidapi
];
# Install udev rules in this package's out path:
mesonFlags = [
"-Dudevrulesdir=lib/udev/rules.d"
];
postFixup =
let
GST_PLUGIN_PATH = lib.makeSearchPathOutput "lib" "lib/gstreamer-1.0" [
gst_all_1.gst-plugins-base
(gst_all_1.gst-plugins-good.override { gtkSupport = true; })
];
in
lib.optionalString stdenv.hostPlatform.isLinux ''
wrapProgram $out/bin/usbkvm \
--prefix GST_PLUGIN_PATH : "${GST_PLUGIN_PATH}"
'';
doInstallCheck = true;
meta = {
homepage = "https://github.com/carrotIndustries/usbkvm";
description = "Open-source USB KVM (Keyboard, Video and Mouse) adapter";
changelog = "https://github.com/carrotIndustries/usbkvm/releases/tag/v${version}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ lschuermann ];
mainProgram = "usbkvm";
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/meson.build b/meson.build
index 6e60b0b..b25da9d 100644
--- a/meson.build
+++ b/meson.build
@@ -125,7 +125,7 @@ mslib = custom_target(
'mslib',
output: ['mslib.a', 'mslib.h'],
input: 'ms-tools/lib/mslib.go',
- command: ['go', 'build', '-C', join_paths(meson.current_source_dir(), 'ms-tools/lib'), '-o', join_paths(meson.current_build_dir(), '@OUTPUT0@'), '-buildmode=c-archive', 'mslib.go']
+ command: ['cp', '@MSLIB_A_PRECOMPILED@', '@MSLIB_H_PRECOMPILED@', join_paths(meson.current_build_dir(), '@OUTDIR@')]
)

View File

@@ -0,0 +1,60 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
libimobiledevice,
libusb1,
}:
stdenv.mkDerivation rec {
pname = "usbmuxd";
version = "1.1.1+date=2023-05-05";
src = fetchFromGitHub {
owner = "libimobiledevice";
repo = "usbmuxd";
rev = "01c94c77f59404924f1c46d99c4e5e0c7817281b";
hash = "sha256-WqbobkzlJ9g5fb9S2QPi3qdpCLx3pxtNlT7qDI63Zp4=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
];
propagatedBuildInputs = [
libimobiledevice
libusb1
];
preAutoreconf = ''
export RELEASE_VERSION=${version}
'';
configureFlags = [
"--with-udevrulesdir=${placeholder "out"}/lib/udev/rules.d"
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
];
doInstallCheck = true;
meta = with lib; {
homepage = "https://github.com/libimobiledevice/usbmuxd";
description = "Socket daemon to multiplex connections from and to iOS devices";
longDescription = ''
usbmuxd stands for "USB multiplexing daemon". This daemon is in charge of
multiplexing connections over USB to an iOS device. To users, it means
you can sync your music, contacts, photos, etc. over USB. To developers, it
means you can connect to any listening localhost socket on the device. usbmuxd
is not used for tethering data transfer which uses a dedicated USB interface as
a virtual network device. Multiple connections to different TCP ports can happen
in parallel. The higher-level layers are handled by libimobiledevice.
'';
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = [ ];
mainProgram = "usbmuxd";
};
}

View File

@@ -0,0 +1,68 @@
{
lib,
clangStdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
libimobiledevice,
libusb1,
avahi,
clang,
git,
libgeneral,
}:
clangStdenv.mkDerivation {
pname = "usbmuxd2";
version = "unstable-2023-12-12";
src = fetchFromGitHub {
owner = "tihmstar";
repo = "usbmuxd2";
rev = "2ce399ddbacb110bd5a83a6b8232d42c9a9b6e84";
hash = "sha256-UVLLE73XuWTgGlpTMxUDykFmiBDqz6NCRO2rpRAYfow=";
# Leave DotGit so that autoconfigure can read version from git tags
leaveDotGit = true;
};
postPatch = ''
# Checking for libgeneral version still fails
sed -i 's/libgeneral >= $LIBGENERAL_MINVERS_STR/libgeneral/' configure.ac
# Otherwise, it will complain about no matching function for call to 'find'
sed -i 1i'#include <algorithm>' usbmuxd2/Muxer.cpp
'';
nativeBuildInputs = [
autoreconfHook
clang
git
pkg-config
];
propagatedBuildInputs = [
avahi
libgeneral
libimobiledevice
libusb1
];
doInstallCheck = true;
configureFlags = [
"--with-udevrulesdir=${placeholder "out"}/lib/udev/rules.d"
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
];
makeFlags = [
"sbindir=${placeholder "out"}/bin"
];
meta = {
homepage = "https://github.com/tihmstar/usbmuxd2";
description = "Socket daemon to multiplex connections from and to iOS devices";
license = lib.licenses.lgpl3;
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ onny ];
mainProgram = "usbmuxd";
};
}

View File

@@ -0,0 +1,57 @@
{
lib,
stdenv,
fetchFromGitLab,
pkg-config,
meson,
ninja,
glib,
libusb1,
}:
stdenv.mkDerivation rec {
pname = "usbredir";
version = "0.15.0";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "spice";
repo = "usbredir";
rev = "${pname}-${version}";
sha256 = "sha256-a+RaJO70jxsrVwSG+PzDg2luvBHqBdNdRdLOGhdhjzY=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = [
glib
];
propagatedBuildInputs = [
libusb1
];
mesonFlags = [
"-Dgit_werror=disabled"
"-Dtools=enabled"
"-Dfuzzing=disabled"
];
outputs = [
"out"
"dev"
];
meta = with lib; {
description = "USB traffic redirection protocol";
mainProgram = "usbredirect";
homepage = "https://www.spice-space.org/usbredir.html";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ offline ];
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,49 @@
{
lib,
fetchFromGitHub,
python3,
}:
python3.pkgs.buildPythonApplication {
pname = "usbrip";
version = "0-unstable-2021-07-02";
pyproject = true;
disabled = python3.pythonOlder "3.6";
src = fetchFromGitHub {
owner = "snovvcrash";
repo = "usbrip";
rev = "0f3701607ba13212ebefb4bbd9e68ec0e22d76ac";
sha256 = "1vws8ybhv7szpqvlbmv0hrkys2fhhaa5bj9dywv3q2y1xmljl0py";
};
build-system = with python3.pkgs; [ setuptools ];
dependencies = with python3.pkgs; [
termcolor
terminaltables
tqdm
];
postPatch = ''
# Remove install helpers which we don't need
substituteInPlace setup.py \
--replace-fail "resolve('wheel')" "" \
--replace-fail "'install': LocalInstallCommand," ""
'';
# Project has no tests
doCheck = false;
pythonImportsCheck = [ "usbrip" ];
meta = with lib; {
description = "Tool to track the history of USB events";
mainProgram = "usbrip";
homepage = "https://github.com/snovvcrash/usbrip";
license = with licenses; [ gpl3Plus ];
maintainers = with maintainers; [ fab ];
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,49 @@
{
lib,
python3Packages,
fetchPypi,
udevCheckHook,
}:
python3Packages.buildPythonApplication rec {
pname = "usbsdmux";
version = "25.8";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-/hDDEUvpdpUpg3ZVw8NWcDOLOtLu087Ki7FmGrDh9Gg=";
};
# Remove the wrong GROUP=plugdev.
# The udev rule already has TAG+="uaccess", which is sufficient.
postPatch = ''
substituteInPlace contrib/udev/99-usbsdmux.rules \
--replace-fail 'TAG+="uaccess", GROUP="plugdev"' 'TAG+="uaccess"'
'';
build-system = with python3Packages; [
setuptools
setuptools-scm
];
nativeBuildInputs = [
udevCheckHook
];
doInstallCheck = true;
postInstall = ''
install -Dm0444 -t $out/lib/udev/rules.d/ contrib/udev/99-usbsdmux.rules
'';
pythonImportsCheck = [ "usbsdmux" ];
meta = {
description = "Control software for the LXA USB-SD-Mux";
homepage = "https://github.com/linux-automation/usbsdmux";
license = lib.licenses.lgpl21;
maintainers = with lib.maintainers; [ emantor ];
platforms = with lib.platforms; linux;
};
}

View File

@@ -0,0 +1,47 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
libpcap,
boost,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "usbtop";
version = "1.0";
src = fetchFromGitHub {
owner = "aguinet";
repo = "usbtop";
tag = "release-${finalAttrs.version}";
hash = "sha256-Ws90l5C+KzQC5QgbX7+Hv/Fw5lRAGQoSzJJIgxVoamE=";
};
postPatch =
# fix compatibility with CMake (https://cmake.org/cmake/help/v4.0/command/cmake_minimum_required.html)
# TODO: drop when https://github.com/aguinet/usbtop/pull/45 is merged
''
substituteInPlace CMakeLists.txt \
--replace-fail \
'cmake_minimum_required(VERSION 2.8)' \
'cmake_minimum_required(VERSION 2.8...4.0)'
'';
nativeBuildInputs = [ cmake ];
buildInputs = [
libpcap
boost
];
meta = {
homepage = "https://github.com/aguinet/usbtop";
changelog = "https://github.com/aguinet/usbtop/raw/${finalAttrs.src.rev}/CHANGELOG";
description = "Top utility that shows an estimated instantaneous bandwidth on USB buses and devices";
mainProgram = "usbtop";
maintainers = [ ];
license = lib.licenses.bsd3;
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,14 @@
diff --git a/lsusb.py b/lsusb.py
index bbc4dbb..8af1b1f 100755
--- a/lsusb.py
+++ b/lsusb.py
@@ -27,8 +27,7 @@ showwakeup = False
prefix = "/sys/bus/usb/devices/"
usbids = [
- "/usr/share/hwdata/usb.ids",
- "/usr/share/usb.ids",
+ "@hwdata@/share/hwdata/usb.ids",
]
cols = ("", "", "", "", "", "")

View File

@@ -0,0 +1,73 @@
{
lib,
stdenv,
fetchurl,
replaceVars,
fetchpatch,
meson,
ninja,
pkg-config,
libusb1,
hwdata,
python3,
}:
stdenv.mkDerivation rec {
pname = "usbutils";
version = "018";
src = fetchurl {
url = "mirror://kernel/linux/utils/usb/usbutils/usbutils-${version}.tar.xz";
hash = "sha256-g/aLWbWFR1icACZugmcYZGJ1k6tDYtjIB/UO6pI8rZM=";
};
patches = [
(replaceVars ./fix-paths.patch {
inherit hwdata;
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/24a6945778381a62ecdcc1d78bcc16b9f86778c1/usbutils/portable.patch";
hash = "sha256-spTkWURij4sPLoWtDaWVMIk81AS5W+qUUOQL1pAZEvs=";
})
];
nativeBuildInputs = [
meson
ninja
pkg-config
];
buildInputs = [
libusb1
python3
];
outputs = [
"out"
"man"
]
++ lib.optionals stdenv.hostPlatform.isLinux [
"python" # uses sysfs
];
postInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
moveToOutput "bin/lsusb.py" "$python"
install -Dm555 usbreset -t $out/bin
'';
meta = {
homepage = "http://www.linux-usb.org/";
description = "Tools for working with USB devices, such as lsusb";
maintainers = with lib.maintainers; [
cafkafk
chuangzhu
];
license = with lib.licenses; [
gpl2Only # manpages, usbreset
gpl2Plus # most of the code
];
platforms = with lib.platforms; linux ++ darwin;
mainProgram = "lsusb";
};
}

View File

@@ -0,0 +1,43 @@
{
lib,
stdenv,
fetchFromGitHub,
autoreconfHook,
pkg-config,
imagemagick,
gtk3,
}:
stdenv.mkDerivation rec {
pname = "usbview";
version = "3.1";
src = fetchFromGitHub {
owner = "gregkh";
repo = "usbview";
rev = "v${version}";
hash = "sha256-h+sB83BYsrB2VxwtatPWNiM0WdTCMY289nh+/0o8GOw=";
};
nativeBuildInputs = [
autoreconfHook
pkg-config
imagemagick
];
buildInputs = [
gtk3
];
meta = with lib; {
description = "USB viewer for Linux";
license = licenses.gpl2Only;
homepage = "http://www.kroah.com/linux-usb/";
maintainers = with maintainers; [
shamilton
h7x4
];
platforms = platforms.linux;
mainProgram = "usbview";
};
}

View File

@@ -0,0 +1,53 @@
{
lib,
rustPlatform,
fetchFromGitHub,
libxcrypt,
nixosTests,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "userborn";
version = "0.4.0";
src = fetchFromGitHub {
owner = "nikstur";
repo = "userborn";
rev = version;
hash = "sha256-Zh2u7we/MAIM7varuJA4AmEWeSMuA/C+0NSIUJN7zTs=";
};
sourceRoot = "${src.name}/rust/userborn";
cargoHash = "sha256-oLw/I8PEv75tz+KxbIJrwl8Wr0I/RzDh1SDZ6mRQpL8=";
nativeBuildInputs = [ rustPlatform.bindgenHook ];
buildInputs = [ libxcrypt ];
stripAllList = [ "bin" ];
passthru = {
updateScript = nix-update-script { };
tests = {
inherit (nixosTests)
userborn
userborn-mutable-users
userborn-mutable-etc
userborn-immutable-users
userborn-immutable-etc
;
};
};
meta = {
homepage = "https://github.com/nikstur/userborn";
description = "Declaratively bear (manage) Linux users and groups";
changelog = "https://github.com/nikstur/userborn/blob/${version}/CHANGELOG.md";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ nikstur ];
mainProgram = "userborn";
};
}

View File

@@ -0,0 +1,27 @@
{
lib,
stdenv,
fetchFromGitHub,
}:
stdenv.mkDerivation rec {
pname = "userhosts";
version = "1.0.0";
src = fetchFromGitHub {
owner = "figiel";
repo = "hosts";
rev = "v${version}";
hash = "sha256-9uF0fYl4Zz/Ia2UKx7CBi8ZU8jfWoBfy2QSgTSwXo5A";
};
installFlags = [ "PREFIX=$(out)" ];
meta = with lib; {
description = "Libc wrapper providing per-user hosts file";
homepage = "https://github.com/figiel/hosts";
maintainers = [ maintainers.bobvanderlinden ];
license = licenses.cc0;
platforms = platforms.linux;
};
}

View File

@@ -0,0 +1,45 @@
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
dbus,
libnotify,
udisks2,
gdk-pixbuf,
}:
stdenv.mkDerivation {
pname = "usermount";
version = "0.1";
src = fetchFromGitHub {
owner = "tom5760";
repo = "usermount";
rev = "0d6aba3c1f8fec80de502f5b92fd8b28041cc8e4";
sha256 = "sha256-giMHUVYdAygiemYru20VxpQixr5aGgHhevNkHvkG9z4=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
dbus
libnotify
udisks2
gdk-pixbuf
];
env.NIX_CFLAGS_COMPILE = "-DENABLE_NOTIFICATIONS";
installPhase = ''
mkdir -p $out/bin
mv usermount $out/bin/
'';
meta = {
homepage = "https://github.com/tom5760/usermount";
description = "Simple tool to automatically mount removable drives using UDisks2 and D-Bus";
mainProgram = "usermount";
license = lib.licenses.mit;
platforms = lib.platforms.linux;
};
}

View File

@@ -0,0 +1,35 @@
{
lib,
stdenv,
fetchFromGitHub,
ruby,
}:
stdenv.mkDerivation {
pname = "username-anarchy";
version = "0.5";
src = fetchFromGitHub {
rev = "d5e653f0ab31d8d3fff79b2986f6ef9624d80fba";
owner = "urbanadventurer";
repo = "username-anarchy";
hash = "sha256-1he1FzNc6y7jm/UwedG81z5QGehh2qsd1QkAsIXwrag=";
};
buildInputs = [ ruby ];
preInstall = ''
mkdir -p $out/bin
install -Dm 555 format-plugins.rb $out/bin/
install -Dm 555 username-anarchy $out/bin/
'';
meta = with lib; {
homepage = "https://github.com/urbanadventurer/username-anarchy/";
description = "Username generator tool for penetration testing";
license = licenses.mit;
maintainers = [ maintainers.akechishiro ];
platforms = platforms.unix;
mainProgram = "username-anarchy";
};
}

View File

@@ -0,0 +1,81 @@
{
lib,
fetchFromGitHub,
buildGoModule,
unixODBC,
icu,
nix-update-script,
testers,
usql,
}:
buildGoModule rec {
pname = "usql";
version = "0.19.26";
src = fetchFromGitHub {
owner = "xo";
repo = "usql";
tag = "v${version}";
hash = "sha256-Qs/P7WFoc9w3jYLX48F7KSXLYBjrX0DppJmfZvY6Cq8=";
};
buildInputs = [
unixODBC
icu
];
vendorHash = "sha256-gkC9o7aBZPqHoYODwstRehfaE+Gvtnv7gvKxbnc+BNI=";
proxyVendor = true;
# Exclude drivers from the bad group
# These drivers break too often and are not used.
#
excludedPackages = [
"impala"
];
# These tags and flags are copied from build.sh
tags = [
"most"
"sqlite_app_armor"
"sqlite_fts5"
"sqlite_introspect"
"sqlite_json1"
"sqlite_math_functions"
"sqlite_stat4"
"sqlite_vtable"
"no_adodb"
];
ldflags = [
"-s"
"-w"
"-X github.com/xo/usql/text.CommandVersion=${version}"
];
# All the checks currently require docker instances to run the databases.
doCheck = false;
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
inherit version;
package = usql;
command = "usql --version";
};
};
meta = {
description = "Universal command-line interface for SQL databases";
homepage = "https://github.com/xo/usql";
changelog = "https://github.com/xo/usql/releases/tag/v${version}";
license = lib.licenses.mit;
mainProgram = "usql";
maintainers = with lib.maintainers; [
georgyo
anthonyroussel
];
platforms = with lib.platforms; linux ++ darwin;
};
}

View File

@@ -0,0 +1,61 @@
{
lib,
buildGoModule,
fetchFromGitHub,
stdenv,
nix-update-script,
buildPackages,
installShellFiles,
versionCheckHook,
}:
buildGoModule (finalAttrs: {
pname = "usque";
version = "1.4.1";
src = fetchFromGitHub {
owner = "Diniboy1123";
repo = "usque";
tag = "v${finalAttrs.version}";
hash = "sha256-/4/hsoWGdNe5vF22hFXuItXlYiLZ5BKrfg5XSFyljhE=";
};
vendorHash = "sha256-ngLlG9HP0KJPjIBVsNZuwnlJj2egMEh9U0xVQpVEg1Q=";
ldflags = [
"-s"
"-w"
"-X github.com/Diniboy1123/usque/cmd.version=${finalAttrs.version}"
];
nativeBuildInputs = [ installShellFiles ];
postInstall =
let
exe =
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
"$out/bin/usque"
else
lib.getExe buildPackages.usque;
in
''
installShellCompletion --cmd usque \
--bash <(${exe} completion bash) \
--fish <(${exe} completion fish) \
--zsh <(${exe} completion zsh)
'';
nativeInstallCheckInputs = [
versionCheckHook
];
doInstallCheck = true;
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
versionCheckProgramArg = "version";
passthru.updateScript = nix-update-script { };
meta = {
mainProgram = "usque";
maintainers = with lib.maintainers; [ xddxdd ];
description = "Open-source reimplementation of the Cloudflare WARP client's MASQUE protocol";
homepage = "https://github.com/Diniboy1123/usque";
license = lib.licenses.mit;
changelog = "https://github.com/Diniboy1123/usque/releases/tag/v${finalAttrs.version}";
};
})

View File

@@ -0,0 +1,183 @@
diff --git a/usrsctplib/netinet/sctp_cc_functions.c b/usrsctplib/netinet/sctp_cc_functions.c
index 57bcdaa..70cf8b7 100755
--- a/usrsctplib/netinet/sctp_cc_functions.c
+++ b/usrsctplib/netinet/sctp_cc_functions.c
@@ -764,7 +764,7 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
#if defined(__FreeBSD__) && !defined(__Userspace__)
int old_cwnd;
#endif
- uint32_t t_ssthresh, t_cwnd, incr;
+ uint32_t t_ssthresh, incr;
uint64_t t_ucwnd_sbw;
uint64_t t_path_mptcp;
uint64_t mptcp_like_alpha;
@@ -773,7 +773,6 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
/* MT FIXME: Don't compute this over and over again */
t_ssthresh = 0;
- t_cwnd = 0;
t_ucwnd_sbw = 0;
t_path_mptcp = 0;
mptcp_like_alpha = 1;
@@ -783,7 +782,6 @@ sctp_cwnd_update_after_sack_common(struct sctp_tcb *stcb,
max_path = 0;
TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
t_ssthresh += net->ssthresh;
- t_cwnd += net->cwnd;
/* lastsa>>3; we don't need to devide ...*/
srtt = net->lastsa;
if (srtt > 0) {
diff --git a/usrsctplib/netinet/sctp_indata.c b/usrsctplib/netinet/sctp_indata.c
index 3bce9e9..42ce111 100755
--- a/usrsctplib/netinet/sctp_indata.c
+++ b/usrsctplib/netinet/sctp_indata.c
@@ -3320,7 +3320,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
struct sctp_tmit_chunk *tp1;
int strike_flag = 0;
struct timeval now;
- int tot_retrans = 0;
uint32_t sending_seq;
struct sctp_nets *net;
int num_dests_sacked = 0;
@@ -3691,7 +3690,6 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, struct sctp_association *asoc,
}
tp1->rec.data.doing_fast_retransmit = 1;
- tot_retrans++;
/* mark the sending seq for possible subsequent FR's */
/*
* SCTP_PRINTF("Marking TSN for FR new value %x\n",
diff --git a/usrsctplib/netinet/sctp_output.c b/usrsctplib/netinet/sctp_output.c
index 6a7dff9..a914b3b 100755
--- a/usrsctplib/netinet/sctp_output.c
+++ b/usrsctplib/netinet/sctp_output.c
@@ -9970,7 +9970,7 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
struct mbuf *m, *endofchain;
struct sctp_nets *net = NULL;
uint32_t tsns_sent = 0;
- int no_fragmentflg, bundle_at, cnt_thru;
+ int no_fragmentflg, bundle_at;
unsigned int mtu;
int error, i, one_chunk, fwd_tsn, ctl_cnt, tmr_started;
struct sctp_auth_chunk *auth = NULL;
@@ -10046,7 +10046,6 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
}
}
one_chunk = 0;
- cnt_thru = 0;
/* do we have control chunks to retransmit? */
if (m != NULL) {
/* Start a timer no matter if we succeed or fail */
@@ -10368,7 +10367,6 @@ sctp_chunk_retransmission(struct sctp_inpcb *inp,
/* (void)SCTP_GETTIME_TIMEVAL(&net->last_sent_time); */
/* For auto-close */
- cnt_thru++;
if (*now_filled == 0) {
(void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent);
*now = asoc->time_last_sent;
@@ -13416,7 +13414,7 @@ sctp_lower_sosend(struct socket *so,
struct epoch_tracker et;
#endif
ssize_t sndlen = 0, max_len, local_add_more;
- int error, len;
+ int error;
struct mbuf *top = NULL;
int queue_only = 0, queue_only_for_init = 0;
int free_cnt_applied = 0;
@@ -14035,7 +14033,6 @@ sctp_lower_sosend(struct socket *so,
*/
local_add_more = sndlen;
}
- len = 0;
if (non_blocking) {
goto skip_preblock;
}
@@ -14265,7 +14262,6 @@ skip_preblock:
}
sctp_snd_sb_alloc(stcb, sndout);
atomic_add_int(&sp->length, sndout);
- len += sndout;
if (sinfo_flags & SCTP_SACK_IMMEDIATELY) {
sp->sinfo_flags |= SCTP_SACK_IMMEDIATELY;
}
diff --git a/usrsctplib/netinet/sctp_pcb.c b/usrsctplib/netinet/sctp_pcb.c
index 89a66bc..a952921 100755
--- a/usrsctplib/netinet/sctp_pcb.c
+++ b/usrsctplib/netinet/sctp_pcb.c
@@ -7943,7 +7943,7 @@ sctp_drain_mbufs(struct sctp_tcb *stcb)
}
void
-sctp_drain()
+sctp_drain(void)
{
/*
* We must walk the PCB lists for ALL associations here. The system
diff --git a/usrsctplib/netinet/sctp_sysctl.c b/usrsctplib/netinet/sctp_sysctl.c
index bb49e17..8b77f7e 100755
--- a/usrsctplib/netinet/sctp_sysctl.c
+++ b/usrsctplib/netinet/sctp_sysctl.c
@@ -61,7 +61,7 @@ FEATURE(sctp, "Stream Control Transmission Protocol");
*/
void
-sctp_init_sysctls()
+sctp_init_sysctls(void)
{
SCTP_BASE_SYSCTL(sctp_sendspace) = SCTPCTL_MAXDGRAM_DEFAULT;
SCTP_BASE_SYSCTL(sctp_recvspace) = SCTPCTL_RECVSPACE_DEFAULT;
diff --git a/usrsctplib/user_socket.c b/usrsctplib/user_socket.c
index 513a5a9..89e9eb2 100755
--- a/usrsctplib/user_socket.c
+++ b/usrsctplib/user_socket.c
@@ -2857,7 +2857,6 @@ sctp_userspace_ip_output(int *result, struct mbuf *o_pak,
struct mbuf *m_orig;
int iovcnt;
int len;
- int send_count;
struct ip *ip;
struct udphdr *udp;
struct sockaddr_in dst;
@@ -2930,16 +2929,13 @@ sctp_userspace_ip_output(int *result, struct mbuf *o_pak,
m_adj(m, sizeof(struct ip) + sizeof(struct udphdr));
}
- send_count = 0;
for (iovcnt = 0; m != NULL && iovcnt < MAXLEN_MBUF_CHAIN; m = m->m_next, iovcnt++) {
#if !defined(_WIN32)
send_iovec[iovcnt].iov_base = (caddr_t)m->m_data;
send_iovec[iovcnt].iov_len = SCTP_BUF_LEN(m);
- send_count += send_iovec[iovcnt].iov_len;
#else
send_iovec[iovcnt].buf = (caddr_t)m->m_data;
send_iovec[iovcnt].len = SCTP_BUF_LEN(m);
- send_count += send_iovec[iovcnt].len;
#endif
}
@@ -3002,7 +2998,6 @@ void sctp_userspace_ip6_output(int *result, struct mbuf *o_pak,
struct mbuf *m_orig;
int iovcnt;
int len;
- int send_count;
struct ip6_hdr *ip6;
struct udphdr *udp;
struct sockaddr_in6 dst;
@@ -3076,16 +3071,13 @@ void sctp_userspace_ip6_output(int *result, struct mbuf *o_pak,
m_adj(m, sizeof(struct ip6_hdr));
}
- send_count = 0;
for (iovcnt = 0; m != NULL && iovcnt < MAXLEN_MBUF_CHAIN; m = m->m_next, iovcnt++) {
#if !defined(_WIN32)
send_iovec[iovcnt].iov_base = (caddr_t)m->m_data;
send_iovec[iovcnt].iov_len = SCTP_BUF_LEN(m);
- send_count += send_iovec[iovcnt].iov_len;
#else
send_iovec[iovcnt].buf = (caddr_t)m->m_data;
send_iovec[iovcnt].len = SCTP_BUF_LEN(m);
- send_count += send_iovec[iovcnt].len;
#endif
}
if (m != NULL) {

View File

@@ -0,0 +1,55 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchpatch,
cmake,
}:
stdenv.mkDerivation rec {
pname = "usrsctp";
version = "0.9.5.0";
src = fetchFromGitHub {
owner = "sctplab";
repo = "usrsctp";
rev = version;
sha256 = "10ndzkip8blgkw572n3dicl6mgjaa7kygwn3vls80liq92vf1sa9";
};
patches = [
# usrsctp fails to build with clang 15+ due to set but unused variable and missing prototype
# errors. These issues are fixed in the master branch, but a new release with them has not
# been made. The following patch can be dropped once a release has been made.
./clang-fix-build.patch
(fetchpatch {
name = "freebsd-14.patch";
url = "https://github.com/sctplab/usrsctp/commit/ac559d2a95277e5e0827e9ee5a1d3b1b50e0822a.patch";
hash = "sha256-QBlzH37Xwwnn1y8pM941Zesz18p2EazfeD0lCU8n6nI=";
})
(fetchpatch {
name = "usrsctp-fix-cmake-4.patch";
url = "https://github.com/sctplab/usrsctp/commit/7569d2ce1e8658534369ad9726ca62139211db84.patch";
hash = "sha256-Hxp1SGwmpm6UK//KFLQoOmmI0a1QpSNaTaEEUbC8jbg=";
})
];
nativeBuildInputs = [ cmake ];
# https://github.com/sctplab/usrsctp/issues/662
postPatch = ''
substituteInPlace usrsctplib/CMakeLists.txt \
--replace '$'{exec_prefix}/'$'{CMAKE_INSTALL_LIBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
--replace '$'{prefix}/'$'{CMAKE_INSTALL_INCLUDEDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR}
'';
meta = with lib; {
homepage = "https://github.com/sctplab/usrsctp";
description = "Portable SCTP userland stack";
maintainers = with maintainers; [ misuzu ];
license = licenses.bsd3;
platforms = platforms.unix;
};
}

View File

@@ -0,0 +1,52 @@
{
lib,
stdenv,
fetchgit,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "ustr";
version = "1.0.4";
src = fetchgit {
url = "http://www.and.org/ustr/ustr.git";
rev = "v${finalAttrs.version}";
hash = "sha256-pQrQy+S9fVFl8Mop4QmwEAXGiBSheQE4HgAZ4srFz64=";
};
# Fixes bogus warnings that failed libsemanage
patches = [ ./va_args.patch ];
# Work around gcc5 switch to gnu11
env.NIX_CFLAGS_COMPILE = "-std=gnu89";
# Fix detection of stdint.h
postPatch = ''
substituteInPlace Makefile \
--replace-fail "have_stdint_h=0" "have_stdint_h=1"
cat ustr-import.in | grep USTR_CONF
substituteInPlace ustr-import.in \
--replace-fail "USTR_CONF_HAVE_STDINT_H 0" "USTR_CONF_HAVE_STDINT_H 1"
'';
makeFlags = [
"prefix=${placeholder "out"}"
"LDCONFIG=echo"
"HIDE="
];
# Remove debug libraries
postInstall = ''
find $out/lib -name \*debug\* -delete
'';
meta = {
homepage = "http://www.and.org/ustr/";
description = "Micro String API for C language";
mainProgram = "ustr-import";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ sigmanificient ];
platforms = lib.platforms.linux;
};
})

View File

@@ -0,0 +1,23 @@
diff --git a/ustr-compiler.h b/ustr-compiler.h
index 9e71276..c5f847a 100644
--- a/ustr-compiler.h
+++ b/ustr-compiler.h
@@ -11,17 +11,11 @@
#define USTR_CONF_HAVE_ATTR_FMT 1
#endif
+#include <stdarg.h>
/* We assume this is enough,
* C99 specifies that va_copy() exists and is a macro */
-#ifdef va_copy
# define USTR_CONF_HAVE_VA_COPY 1
# define USTR__VA_COPY(x, y) va_copy(x, y)
-#elif __va_copy
-# define USTR_CONF_HAVE_VA_COPY 1
-# define USTR__VA_COPY(x, y) __va_copy(x, y)
-#else
-# define USTR_CONF_HAVE_VA_COPY 0
-#endif
#ifndef USTR_CONF_HAVE_ATTR_NONNULL
#if defined(__GNUC__) && (__GNUC__ > 3) /* not sure */

View File

@@ -0,0 +1,92 @@
{
lib,
stdenv,
fetchFromGitHub,
libbsd,
libevent,
libjpeg,
libdrm,
pkg-config,
janus-gateway,
glib,
alsa-lib,
speex,
jansson,
libopus,
nixosTests,
systemdLibs,
which,
withSystemd ? true,
withJanus ? true,
}:
stdenv.mkDerivation rec {
pname = "ustreamer";
version = "6.39";
src = fetchFromGitHub {
owner = "pikvm";
repo = "ustreamer";
tag = "v${version}";
hash = "sha256-Lc0cwzt7rGfbJSLdZTDVdmkub6Z2KnTz5PRpEvtHsKM=";
};
buildInputs = [
libbsd
libevent
libjpeg
libdrm
]
++ lib.optionals withSystemd [
systemdLibs
]
++ lib.optionals withJanus [
janus-gateway
glib
alsa-lib
jansson
speex
libopus
];
nativeBuildInputs = [
pkg-config
which
];
makeFlags = [
"PREFIX=${placeholder "out"}"
"WITH_V4P=1"
]
++ lib.optionals withSystemd [
"WITH_SYSTEMD=1"
]
++ lib.optionals withJanus [
"WITH_JANUS=1"
# Workaround issues with Janus C Headers
# https://github.com/pikvm/ustreamer/blob/793f24c4/docs/h264.md#fixing-janus-c-headers
"CFLAGS=-I${lib.getDev janus-gateway}/include/janus"
];
enableParallelBuilding = true;
passthru.tests = { inherit (nixosTests) ustreamer; };
meta = with lib; {
homepage = "https://github.com/pikvm/ustreamer";
description = "Lightweight and fast MJPG-HTTP streamer";
longDescription = ''
µStreamer is a lightweight and very quick server to stream MJPG video from
any V4L2 device to the net. All new browsers have native support of this
video format, as well as most video players such as mplayer, VLC etc.
µStreamer is a part of the Pi-KVM project designed to stream VGA and HDMI
screencast hardware data with the highest resolution and FPS possible.
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [
tfc
matthewcroughan
];
platforms = platforms.linux;
mainProgram = "ustreamer";
};
}

View File

@@ -0,0 +1,41 @@
{
lib,
stdenv,
fetchFromGitHub,
scsh,
rsync,
unison,
}:
stdenv.mkDerivation {
pname = "usync";
version = "0.0.3";
src = fetchFromGitHub {
owner = "ebzzry";
repo = "usync";
rev = "99f11b0c196a81843f55ca3456abcb85149b6d51";
sha256 = "16i1q8f0jmfd43rb8d70l2b383vr5ib4kh7iq3yd345q7xjz9c2j";
};
installPhase = ''
install -m 555 -Dt $out/bin $pname
'';
postFixup = ''
substituteInPlace $out/bin/$pname --replace "/usr/bin/env scsh" "${scsh}/bin/scsh"
substituteInPlace $out/bin/$pname --replace "(rsync " "(${rsync}/bin/rsync "
substituteInPlace $out/bin/$pname --replace "(unison " "(${unison}/bin/unison "
'';
meta = with lib; {
homepage = "https://github.com/ebzzry/usync";
description = "Simple site-to-site synchronization tool";
license = licenses.mit;
maintainers = [ maintainers.ebzzry ];
platforms = platforms.unix;
mainProgram = "usync";
};
dontBuild = true;
}