uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,48 @@
{ lib, stdenv, fetchFromGitLab, dtc, installShellFiles }:
stdenv.mkDerivation rec {
pname = "argononed";
version = "unstable-2022-03-26";
src = fetchFromGitLab {
owner = "DarkElvenAngel";
repo = pname;
rev = "97c4fa07fc2c09ffc3bd86e0f6319d50fa639578";
sha256 = "sha256-5/xUYbprRiwD+FN8V2cUpHxnTbBkEsFG2wfsEXrCrgQ=";
};
patches = [ ./fix-hardcoded-reboot-poweroff-paths.patch ];
postPatch = ''
patchShebangs configure
'';
nativeBuildInputs = [ installShellFiles ];
buildInputs = [ dtc ];
installPhase = ''
runHook preInstall
install -Dm755 build/argononed $out/bin/argononed
install -Dm755 build/argonone-cli $out/bin/argonone-cli
install -Dm755 build/argonone-shutdown $out/lib/systemd/system-shutdown/argonone-shutdown
install -Dm644 build/argonone.dtbo $out/boot/overlays/argonone.dtbo
install -Dm644 OS/_common/argononed.service $out/lib/systemd/system/argononed.service
install -Dm644 OS/_common/argononed.logrotate $out/etc/logrotate.d/argononed
install -Dm644 LICENSE $out/share/argononed/LICENSE
installShellCompletion --bash --name argonone-cli OS/_common/argonone-cli-complete.bash
runHook postInstall
'';
meta = with lib; {
homepage = "https://gitlab.com/DarkElvenAngel/argononed";
description = "A replacement daemon for the Argon One Raspberry Pi case";
license = licenses.mit;
platforms = platforms.linux;
maintainers = [ maintainers.misterio77 ];
};
}

View file

@ -0,0 +1,18 @@
--- a/src/argononed.c
+++ b/src/argononed.c
@@ -783,13 +783,13 @@
{
log_message(LOG_DEBUG, "EXEC REBOOT");
sync();
- system("/sbin/reboot");
+ system("/run/current-system/sw/bin/reboot");
}
if (count >= 39 && count <= 41)
{
log_message(LOG_DEBUG, "EXEC SHUTDOWN");
sync();
- system("/sbin/poweroff");
+ system("/run/current-system/sw/bin/poweroff");
}
#else
log_message(LOG_INFO,"Daemon Ready");

View file

@ -0,0 +1,13 @@
{ runCommand, fetchurl, rpm, cpio }: let
version = "1.3-1";
src = fetchurl {
url = "http://downloads.dell.com/printer/Dell-5130cdn-Color-Laser-${version}.noarch.rpm";
sha256 = "0pj32sj6jcdnpa5v75af0hnvx4z0ky0m1k2522cfdx4cb1r2lna9";
};
in runCommand "Dell-5130cdn-Color-Laser-1.3-1" {} ''
mkdir -p usr/share/cups/model
${rpm}/bin/rpm2cpio ${src} | ${cpio}/bin/cpio -i
mkdir -p $out/share/ppd
mv usr/share/cups/model/Dell $out/share/ppd
''

View file

@ -0,0 +1,384 @@
{ lib, stdenv
, fetchurl
, fetchpatch
, makeWrapper
, symlinkJoin
, pkg-config
, libtool
, gtk2
, libxml2
, libxslt
, libusb-compat-0_1
, sane-backends
, rpm
, cpio
, getopt
, autoPatchelfHook
, gcc
}:
let common_meta = {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX";
license = with lib.licenses; epson;
platforms = with lib.platforms; linux;
};
in
############################
#
# PLUGINS
#
############################
# adding a plugin for another printer shouldn't be too difficult, but you need the firmware to test...
let plugins = {
v330 = stdenv.mkDerivation rec {
name = "iscan-v330-bundle";
version = "2.30.4";
src = fetchurl {
# To find new versions, visit
# http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
# some printer like for instance "WF-7210" to get to the most recent
# version.
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/perfection-v330/rpm/x64/iscan-perfection-v330-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "056c04pfsf98nnknphg28l489isqb6y4l2c8g7wqhclwgj7m338i";
};
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
${rpm}/bin/rpm2cpio plugins/esci-interpreter-perfection-v330-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out{,/share,/lib}
cp -r ./usr/share/{iscan-data,esci}/ $out/share/
cp -r ./usr/lib64/esci $out/lib
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0142 "$plugin/lib/esci/libesci-interpreter-perfection-v330 $plugin/share/esci/esfwad.bin"
'';
hw = "Perfection V330 Photo";
};
meta = common_meta // { description = "Plugin to support " + passthru.hw + " scanner in sane"; };
};
v370 = stdenv.mkDerivation rec {
name = "iscan-v370-bundle";
version = "2.30.4";
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/perfection-v370/rpm/x64/iscan-perfection-v370-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/perfection-v370/rpm/x64/iscan-perfection-v370-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1ff7adp9mha1i2ibllz540xkagpy8r757h4s3h60bgxbyzv2yggr";
};
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-perfection-v370-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir -p $out/share $out/lib
cp -r usr/share/{iscan-data,iscan}/ $out/share
cp -r usr/lib64/iscan $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x014a "$plugin/lib/esci/libiscan-plugin-perfection-v370 $plugin/share/esci/esfwdd.bin"
'';
hw = "Perfection V37/V370";
};
meta = common_meta // { description = "Plugin to support " + passthru.hw + " scanner in sane"; };
};
v600 = stdenv.mkDerivation rec {
pname = "iscan-gt-x820-bundle";
version = "2.30.4";
nativeBuildInputs = [ autoPatchelfHook rpm ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-x820/rpm/x64/iscan-gt-x820-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-x820/rpm/x64/iscan-gt-x820-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1vlba7dsgpk35nn3n7is8nwds3yzlk38q43mppjzwsz2d2n7sr33";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-gt-x820-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x013a "$plugin/lib/esci/libesintA1 $plugin/share/esci/esfwA1.bin"
'';
hw = "Perfection V600 Photo";
};
meta = common_meta // { description = "iscan esci x820 plugin for " + passthru.hw; };
};
x770 = stdenv.mkDerivation rec {
pname = "iscan-gt-x770-bundle";
version = "2.30.4";
nativeBuildInputs = [ autoPatchelfHook rpm ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-x770/rpm/x64/iscan-gt-x770-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1chxdm6smv2d14pn2jl9xyd0vr42diy7vpskd3b9a61gf5h3gj03";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-gt-x770-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0130 "$plugin/lib/esci/libesint7C $plugin/share/esci/esfw7C.bin"
'';
hw = "Perfection V500 Photo";
};
meta = common_meta // { description = "iscan esci x770 plugin for " + passthru.hw; };
};
f720 = stdenv.mkDerivation rec {
pname = "iscan-gt-f720-bundle";
version = "2.30.4";
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ gcc.cc.lib ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-f720/rpm/x64/iscan-gt-f720-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "1xnbmb2rn610kqpg1x6k1cc13zlmx2f3l2xnj6809rnhg96qqn20";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio esci-interpreter-gt-f720-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0131 "$plugin/lib/esci/libesci-interpreter-gt-f720 $plugin/share/esci/esfw8b.bin"
'';
hw = "GT-F720, GT-S620, Perfection V30, Perfection V300 Photo";
};
meta = common_meta // { description = "iscan esci f720 plugin for " + passthru.hw; };
};
s80 = stdenv.mkDerivation rec {
pname = "iscan-gt-s80-bundle";
version = "2.30.4";
nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [ gcc.cc.lib libtool ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-s80/rpm/x64/iscan-gt-s80-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "00qfdgs03k7bbs67zjrk8hbxvlyinsmk890amp9cmpfjfzdxgg58";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio esci-interpreter-gt-s80-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
${rpm}/bin/rpm2cpio iscan-plugin-esdip-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mkdir $out/share/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x0136 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
$registry --add interpreter usb 0x04b8 0x0137 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
$registry --add interpreter usb 0x04b8 0x0143 "$plugin/lib/esci/libesci-interpreter-gt-s50.so"
$registry --add interpreter usb 0x04b8 0x0144 "$plugin/lib/esci/libesci-interpreter-gt-s80.so"
'';
hw = "ES-D200, ED-D350, ES-D400, GT-S50, GT-S55, GT-S80, GT-S85";
};
meta = common_meta // { description = "iscan esci s80 plugin for " + passthru.hw; };
};
s650 = stdenv.mkDerivation rec {
name = "iscan-gt-s650-bundle";
version = "2.30.4";
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/plugin/gt-s650/rpm/x64/iscan-gt-s650-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/plugin/gt-s650/rpm/x64/iscan-gt-s650-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "0fn4lz4g0a8l301v6yv7fwl37wgwhz5y90nf681f655xxc91hqh7";
};
nativeBuildInputs = [ autoPatchelfHook rpm ];
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-plugin-gt-s650-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mv $out/share/iscan $out/share/esci
mv $out/lib/iscan $out/lib/esci
'';
passthru = {
registrationCommand = ''
$registry --add interpreter usb 0x04b8 0x013c "$plugin/lib/esci/libiscan-plugin-gt-s650 $plugin/share/esci/esfw010c.bin"
$registry --add interpreter usb 0x04b8 0x013d "$plugin/lib/esci/libiscan-plugin-gt-s650 $plugin/share/esci/esfw010c.bin"
'';
hw = "GT-S650, Perfection V19, Perfection V39";
};
meta = common_meta // { description = "iscan GT-S650 for " + passthru.hw; };
};
network = stdenv.mkDerivation rec {
pname = "iscan-nt-bundle";
# for the version, look for the driver of XP-750 in the search page
version = "2.30.4";
buildInputs = [ stdenv.cc.cc.lib ];
nativeBuildInputs = [ autoPatchelfHook ];
src = fetchurl {
urls = [
"https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
"https://web.archive.org/web/https://download2.ebz.epson.net/iscan/general/rpm/x64/iscan-bundle-${version}.x64.rpm.tar.gz"
];
sha256 = "0jssigsgkxb9i7qa7db291a1gbvwl795i4ahvb7bnqp33czkj85k";
};
installPhase = ''
cd plugins
${rpm}/bin/rpm2cpio iscan-network-nt-*.x86_64.rpm | ${cpio}/bin/cpio -idmv
mkdir $out
cp -r usr/share $out
cp -r usr/lib64 $out/lib
mkdir $out/share/esci
'';
passthru = {
registrationCommand = "";
hw = "network";
};
meta = common_meta // { description = "iscan network plugin"; };
};
};
in
let fwdir = symlinkJoin {
name = "esci-firmware-dir";
paths = lib.mapAttrsToList (name: value: value + /share/esci) plugins;
};
in
let iscan-data = stdenv.mkDerivation rec {
pname = "iscan-data";
version = "1.39.2-1";
src = fetchurl {
urls = [
"http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
"https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan-data_${version}.tar.gz"
];
sha256 = "092qhlnjjgz11ifx6mng7mz20i44gc0nlccrbmw18xr5hipbqqka";
};
buildInputs = [
libxslt
];
meta = common_meta;
};
in
stdenv.mkDerivation rec {
pname = "iscan";
version = "2.30.4-2";
src = fetchurl {
urls = [
"http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
"https://web.archive.org/web/http://support.epson.net/linux/src/scanner/iscan/iscan_${version}.tar.gz"
];
sha256 = "1ma76jj0k3bz0fy06fiyl4di4y77rcryb0mwjmzs5ms2vq9rjysr";
};
nativeBuildInputs = [ pkg-config libtool makeWrapper ];
buildInputs = [
gtk2
libxml2
libusb-compat-0_1
sane-backends
];
patches = [
# Patch for compatibility with libpng versions greater than 10499
(fetchpatch {
urls = [
"https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf"
"https://web.archive.org/web/https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-2.28.1.3+libpng-1.5.patch?h=b6e4c805d53b49da79a0f64ef16bb82d6d800fcf"
];
sha256 = "04y70qjd220dpyh771fiq50lha16pms98mfigwjczdfmx6kpj1jd";
})
# Patch iscan to search appropriate folders for firmware files
./firmware_location.patch
# Patch deprecated use of sscanf code to use a more modern C99 compatible version
./sscanf.patch
];
patchFlags = [ "-p0" ];
configureFlags = [ "--enable-dependency-reduction" "--disable-frontend" ];
postConfigure = ''
echo '#define NIX_ESCI_PREFIX "'${fwdir}'"' >> config.h
'';
postInstall = ''
mkdir -p $out/etc/sane.d
cp backend/epkowa.conf $out/etc/sane.d
echo "epkowa" > $out/etc/sane.d/dll.conf
ln -s ${iscan-data}/share/iscan-data $out/share/iscan-data
mkdir -p $out/lib/iscan
ln -s ${plugins.network}/lib/iscan/network $out/lib/iscan/network
'';
postFixup = ''
# iscan-registry is a shell script requiring getopt
wrapProgram $out/bin/iscan-registry --prefix PATH : ${getopt}/bin
registry=$out/bin/iscan-registry;
'' +
lib.concatStrings (lib.mapAttrsToList
(name: value: ''
plugin=${value};
${value.passthru.registrationCommand}
'')
plugins);
meta = common_meta // {
description = "sane-epkowa backend for some epson scanners";
longDescription = ''
Includes gui-less iscan (aka. Image Scan! for Linux).
Supported hardware: at least :
'' +
lib.concatStringsSep ", " (lib.mapAttrsToList (name: value: value.passthru.hw) plugins);
maintainers = with lib.maintainers; [ symphorien dominikh ];
};
}

View file

@ -0,0 +1,21 @@
Explanation:
in libesci-interpreter-gt-f720.so in
libesci_interpreter_gt_f720_342::libesci_interpreter_gt_f720_348 at 0xdf74: the
binary blob esfw8b.bin is searched either in /usr/share/esci/ or in
$ESCI_FIRMWARE_DIR. But since this library is to be used wia libsane.so in
every binary in the system, we can't wrapProgram the relevant executables to
set this environment variable. Instead, we patch iscan to set this variable
before loading libesci-interpreter-gt-f720.so.
--- backend/channel-usb.c.orig 2017-08-14 11:24:27.669582456 +0200
+++ backend/channel-usb.c 2017-08-14 11:31:40.509010897 +0200
@@ -169,6 +169,10 @@
{
SANE_Status s;
+ setenv("ESCI_FIRMWARE_DIR", NIX_ESCI_PREFIX, 1);
+ setenv("ISCAN_FW_DIR", NIX_ESCI_PREFIX, 1);
+ setenv("ISCAN_FIRMWARE_DIR", NIX_ESCI_PREFIX, 1);
+
s = sanei_usb_open (self->name, &self->fd);
if (SANE_STATUS_GOOD == s)

View file

@ -0,0 +1,29 @@
The "%as" verb requests sscanf to allocate a buffer for us. However,
this use of 'a' has been long deprecated, and gcc doesn't support it
in this manner when using -std=c99. The modern replacement is "%ms".
Without this change, iscan couldn't read the interpreter file, in turn
breaking all scanners that require plugins.
--- backend/cfg-obj.c.orig 2020-03-19 01:27:17.254762077 +0100
+++ backend/cfg-obj.c 2020-03-19 02:01:52.293329873 +0100
@@ -1026,7 +1026,7 @@
char *vendor = NULL;
char *model = NULL;
- sscanf (string, "%*s %as %as", &vendor, &model);
+ sscanf (string, "%*s %ms %ms", &vendor, &model);
if (list_append (_cfg->seen[CFG_KEY_SCSI], info))
{
@@ -1108,10 +1112,10 @@
char *library = NULL;
char *firmware = NULL;
- sscanf (string, "%*s %*s %x %x %as %as",
+ sscanf (string, "%*s %*s %x %x %ms %ms",
&vendor, &product, &library, &firmware);
if (library && _cfg_have_interpreter (library, firmware)
&& list_append (_cfg->seen[CFG_KEY_INTERPRETER], info))
{

View file

@ -0,0 +1,77 @@
{ lib, stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
let
version = "1.0.1";
filterVersion = "1.0.0";
in
stdenv.mkDerivation {
pname = "epson-201106w";
inherit version;
src = fetchurl {
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201106w-${version}-1lsb3.2.src.rpm"
"https://web.archive.org/web/https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201106w-${version}-1lsb3.2.src.rpm"
];
sha256 = "1yig1xrh1ikblbp7sx706n5nnc237wy4mbch23ymy6akbgqg4aig";
};
nativeBuildInputs = [ rpmextract autoreconfHook file ];
buildInputs = [ libjpeg cups ];
unpackPhase = ''
rpmextract $src
tar -zxf epson-inkjet-printer-201106w-${version}.tar.gz
tar -zxf epson-inkjet-printer-filter-${filterVersion}.tar.gz
for ppd in epson-inkjet-printer-201106w-${version}/ppds/*; do
substituteInPlace $ppd --replace "/opt/epson-inkjet-printer-201106w" "$out"
substituteInPlace $ppd --replace "/cups/lib" "/lib/cups"
done
cd epson-inkjet-printer-filter-${filterVersion}
'';
preConfigure = ''
chmod +x configure
export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
'';
postInstall = ''
cd ../epson-inkjet-printer-201106w-${version}
cp -a lib64 resource watermark $out
mkdir -p $out/share/cups/model/epson-inkjet-printer-201106w
cp -a ppds $out/share/cups/model/epson-inkjet-printer-201106w/
cp -a Manual.txt $out/doc/
cp -a README $out/doc/README.driver
'';
meta = with lib; {
homepage = "https://www.openprinting.org/driver/epson-201106w";
description = "Epson printer driver (BX535WD, BX630FW, BX635FWD, ME940FW, NX530, NX635, NX635, SX535WD, WorkForce 545, WorkForce 645";
longDescription = ''
This software is a filter program used with the Common UNIX Printing
System (CUPS) under Linux. It supplies high quality printing with
Seiko Epson Color Ink Jet Printers.
List of printers supported by this package:
Epson BX535WD Series
Epson BX630FW Series
Epson BX635FWD Series
Epson ME940FW Series
Epson NX530 Series
Epson SX535WD Series
Epson WorkForce 545 Series
Epson WorkForce 645 Series
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson-201106w ];
};
'';
license = with licenses; [ lgpl21 epson ];
platforms = platforms.linux;
maintainers = [ maintainers.nphilou ];
};
}

View file

@ -0,0 +1,67 @@
{ lib, stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
let
version = "1.0.0";
filterVersion = "1.0.0";
in stdenv.mkDerivation {
pname = "epson-201401w";
inherit version;
src = fetchurl {
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download3.ebz.epson.net/dsc/f/03/00/03/45/41/92e9c9254f0ee4230a069545ba27ec2858a2c457/epson-inkjet-printer-201401w-1.0.0-1lsb3.2.src.rpm"
"https://web.archive.org/web/20200725175832/https://download3.ebz.epson.net/dsc/f/03/00/03/45/41/92e9c9254f0ee4230a069545ba27ec2858a2c457/epson-inkjet-printer-201401w-1.0.0-1lsb3.2.src.rpm"
];
sha256 = "0c60m1sd59s4sda38dc5nniwa7dh1b0kv1maajr0x9d38gqlyk3x";
};
patches = [ ./fixbuild.patch ];
nativeBuildInputs = [ rpmextract autoreconfHook file ];
buildInputs = [ libjpeg cups ];
unpackPhase = ''
rpmextract $src
tar -zxf epson-inkjet-printer-201401w-${version}.tar.gz
tar -zxf epson-inkjet-printer-filter-${filterVersion}.tar.gz
for ppd in epson-inkjet-printer-201401w-${version}/ppds/*; do
substituteInPlace $ppd --replace "/opt/epson-inkjet-printer-201401w" "$out"
substituteInPlace $ppd --replace "/cups/lib" "/lib/cups"
done
cd epson-inkjet-printer-filter-${filterVersion}
'';
preConfigure = ''
chmod +x configure
'';
postInstall = ''
cd ../epson-inkjet-printer-201401w-${version}
cp -a lib64 resource watermark $out
mkdir -p $out/share/cups/model/epson-inkjet-printer-201401w
cp -a ppds $out/share/cups/model/epson-inkjet-printer-201401w/
cp -a Manual.txt $out/doc/
cp -a README $out/doc/README.driver
'';
meta = with lib; {
homepage = "https://www.openprinting.org/driver/epson-201401w";
description =
"Epson printer driver (L456, L455, L366, L365, L362, L360, L312, L310, L222, L220, L132, L130)";
longDescription = ''
This software is a filter program used with the Common UNIX Printing
System (CUPS) under Linux. It supplies high quality printing with
Seiko Epson Color Ink Jet Printers.
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson-201401w ];
};
'';
license = with licenses; [ lgpl21 epson ];
platforms = platforms.linux;
maintainers = [ maintainers.lunarequest ];
};
}

View file

@ -0,0 +1,101 @@
diff --git a/src/pagemanager/pagemanager.c b/src/pagemanager/pagemanager.c
index 029e6d3..3c1f450 100644
--- a/src/pagemanager/pagemanager.c
+++ b/src/pagemanager/pagemanager.c
@@ -22,7 +22,7 @@
#include "epcgdef.h"
#include "debuglog.h"
#include "memory.h"
-#include "raster.h"
+#include "raster-helper.h"
#include "pagemanager.h"
extern int JobCanceled;
@@ -45,7 +45,7 @@ fetchRaster(EpsPageManager *pageManager)
int error = 0;
int did_fetch = 0;
int read_bytes = 0;
- int nraster;
+ size_t nraster;
while (error == 0 && did_fetch == 0 && JobCanceled == 0) {
eps_raster_fetch(privateData->raster_h, NULL, 0, 0, &status);
@@ -212,7 +212,7 @@ int pageManagerGetPageRegion(EpsPageManager *pageManager, EpsPageRegion *pageReg
return EPS_OK;
}
-int pageManagerGetRaster(EpsPageManager *pageManager, char *buf, int bufSize)
+size_t pageManagerGetRaster(EpsPageManager *pageManager, char *buf, int bufSize)
{
PageManagerPrivateData *privateData = NULL;
int error = EPS_OK;
diff --git a/src/pagemanager/pagemanager.h b/src/pagemanager/pagemanager.h
index 87fbbd5..c9743fb 100644
--- a/src/pagemanager/pagemanager.h
+++ b/src/pagemanager/pagemanager.h
@@ -31,7 +31,7 @@ extern "C"
#define EPS_ERROR -1
#define EPS_OK 0
-typedef int (*EpsRasterSource)(char *buf, int bufSize);
+typedef size_t (*EpsRasterSource)(char *buf, int bufSize);
typedef struct {
EpsRasterSource rasterSource;
@@ -47,7 +47,7 @@ typedef struct {
EpsPageManager* pageManagerCreate(EpsPageRegion pageRegion, EpsFilterPrintOption filterPrintOption, EpsRasterSource rasterSource);
void pageManagerDestroy(EpsPageManager *pageManager);
int pageManagerGetPageRegion(EpsPageManager *pageManager, EpsPageRegion *pageRegion);
-int pageManagerGetRaster(EpsPageManager *pageManager, char *buf, int bufSize);
+size_t pageManagerGetRaster(EpsPageManager *pageManager, char *buf, int bufSize);
int pageManagerIsNextPage(EpsPageManager *pageManager);
#ifdef __cplusplus
diff --git a/src/raster/raster.c b/src/raster/raster.c
index 7e4946b..dd5aef6 100644
--- a/src/raster/raster.c
+++ b/src/raster/raster.c
@@ -218,7 +218,7 @@ eps_raster_init (RASTER * handle, EpsRasterOpt * data, EpsRasterPipeline * pipel
/* if raster_p equals NULL means that it is need to flush a page. */
int
-eps_raster_print (RASTER handle, char * raster_p, int raster_bytes, int pixel_num, int * outraster)
+eps_raster_print (RASTER handle, char * raster_p, int raster_bytes, int pixel_num, size_t * outraster)
{
EpsRaster * raster = (EpsRaster *) handle;
EpsRasterPipeline * pipeline = NULL;
diff --git a/src/raster/raster.h b/src/raster/raster.h
index 9be0977..cc5054d 100644
--- a/src/raster/raster.h
+++ b/src/raster/raster.h
@@ -143,7 +143,7 @@ typedef enum {
} EpsRasterFetchStatus;
int eps_raster_init (RASTER *, EpsRasterOpt *, EpsRasterPipeline *);
-int eps_raster_print (RASTER, char *, int, int, int *);
+int eps_raster_print (RASTER, char *, int, int, size_t *);
int eps_raster_fetch (RASTER, char *, int, int, EpsRasterFetchStatus *);
int eps_raster_free (RASTER);
diff --git a/src/raster_to_epson.c b/src/raster_to_epson.c
index 6e621c8..a0811d6 100644
--- a/src/raster_to_epson.c
+++ b/src/raster_to_epson.c
@@ -33,7 +33,7 @@
#include <cups/ppd.h>
#include <cups/raster.h>
-#include "raster.h"
+#include "raster-helper.h"
#include "memory.h"
#include "raster_to_epson.h"
#include "pagemanager.h"
@@ -75,7 +75,7 @@ static int page_no = 0;
static int pageHeight = 0;
#endif
-int rasterSource(char *buf, int bufSize)
+size_t rasterSource(char *buf, int bufSize)
{
int readBytes = 0;
if (JobCanceled == 0) {

View file

@ -0,0 +1,13 @@
diff --git a/configure b/configure
index 0053441..9a6b855 100755
--- a/configure
+++ b/configure
@@ -2833,7 +2833,7 @@ if test $have_cups_config = yes; then
CUPS_LIBS=`cups-config --libs`
CUPS_IMAGE_LIBS=`cups-config --image --libs`
CUPS_SERVER_DIR=`cups-config --serverbin`
- CUPS_DATA_DIR=`cups-config --datadir`
+ CUPS_DATA_DIR="${prefix}/share/cups"
else
{ { echo "$as_me:$LINENO: error: *** 'cups-config' missing, please install CUPS or fix your \$PATH ***" >&5
echo "$as_me: error: *** 'cups-config' missing, please install CUPS or fix your \$PATH ***" >&2;}

View file

@ -0,0 +1,71 @@
{ lib, stdenv, fetchurl, cups, pkgsi686Linux, dpkg, psutils, makeWrapper, ghostscript, bash }:
let
version = "1.2-0";
libstdcpp5 = fetchurl {
url = "mirror://ubuntu/pool/universe/g/gcc-3.3/libstdc++5_3.3.6-17ubuntu1_i386.deb";
sha256 = "10f8zcmqaa7skvg2bz94mnlgqpan4iscvi8913r6iawjh7hiisjy";
};
in
stdenv.mkDerivation {
pname = "epson-alc1100";
inherit version;
src = fetchurl {
url = "https://download3.ebz.epson.net/dsc/f/03/00/11/33/07/4027e99517b5c388d444b8444d719b4b77f7e9db/Epson-ALC1100-filter-1.2.tar.gz";
sha256 = "1dfw75a3kj2aa4iicvlk9kz3jarrsikpnpd4cdpw79scfc5mwm2p";
};
patches = [ ./cups-data-dir.patch ./ppd.patch ];
nativeBuildInputs = [ dpkg makeWrapper ];
buildInputs = [ cups pkgsi686Linux.glibc psutils ghostscript bash ];
postUnpack = ''
dpkg -x ${libstdcpp5} libstdcpp5_i386;
mkdir -p $out/lib;
mv libstdcpp5_i386/usr/lib/* $out/lib;
'';
postFixup = ''
patchelf --set-interpreter ${pkgsi686Linux.glibc}/lib/ld-linux.so.2 \
--set-rpath "${lib.makeLibraryPath [
pkgsi686Linux.glibc
"$out"
]}" $out/bin/alc1100
patchelf --set-rpath "${lib.makeLibraryPath [
pkgsi686Linux.glibc
]}" $out/lib/libstdc++.so.5.0.7
wrapProgram $out/bin/alc1100_lprwrapper.sh \
--suffix PATH : "\$PATH:${psutils}/bin:/var/lib/cups/path/bin"
wrapProgram $out/bin/pstoalc1100.sh \
--suffix PATH : "\$PATH:${psutils}/bin:${ghostscript}/bin:${bash}/bin:/var/lib/cups/path/bin"
'';
meta = with lib; {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
description = "Epson AcuLaser C1100 Driver";
longDescription = ''
This package provides a print filter for printing to EPSON AL-C1100
printers on Linux systems.
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson-alc1100 ];
};
'';
license = with licenses; [ mit eapl ];
maintainers = [ maintainers.eperuffo ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,13 @@
diff --git a/ppd/Epson-AL-C1100-fm3.ppd b/ppd/Epson-AL-C1100-fm3.ppd
index 75c7fff..ecd04c8 100644
--- a/ppd/Epson-AL-C1100-fm3.ppd
+++ b/ppd/Epson-AL-C1100-fm3.ppd
@@ -68,7 +68,7 @@
*%*********** Foomatic Configulations ************
*%pprRIP: foomatic-rip other
*FoomaticIDs: Epson-AL-C1100 alc1100
-*FoomaticRIPCommandLine: "pstoalc1100.sh %C"
+*FoomaticRIPCommandLine: "/var/lib/cups/path/bin/pstoalc1100.sh %C"
*%**************** Paper Handling ******************

View file

@ -0,0 +1,62 @@
diff --git a/configure b/configure_new
index 12b4662..6ec641c 100755
--- a/configure
+++ b/configure_new
@@ -12162,55 +12162,8 @@ else
$as_echo "no" >&6; }
fi
-
-
-if test "xNONE" != "x${prefix}" ; then
- cups_default_prefix="${prefix}"
-else
- cups_default_prefix="${ac_default_prefix}"
-fi
-
-
-# Check whether --with-cupsfilterdir was given.
-if test "${with_cupsfilterdir+set}" = set; then :
- withval=$with_cupsfilterdir;
-else
- with_cupsfilterdir=no
-fi
-
-if test "xno" = "x${with_cupsfilterdir}"; then
- if test "xyes" = "x$have_cups_config" ; then
- CUPS_FILTER_DIR="${cups_default_prefix}`cups-config --serverbin | sed -e 's,^/[^/][^/]*,,'`/filter"
- else
- CUPS_FILTER_DIR="${cups_default_prefix}/lib/cups/filter"
- fi
-else
- CUPS_FILTER_DIR="${with_cupsfilterdir}"
-fi
-
-
-# Check whether --with-cupsppddir was given.
-if test "${with_cupsppddir+set}" = set; then :
- withval=$with_cupsppddir;
-else
- with_cupsppddir=no
-fi
-
-if test "xno" = "x${with_cupsppddir}"; then
- if test -d "${cups_default_prefix}/share/ppd" ; then
- CUPS_PPD_DIR="${cups_default_prefix}/share/ppd"
- elif test "xyes" = "x$have_cups_config" ; then
- CUPS_PPD_DIR="${cups_default_prefix}`cups-config --datadir | sed -e 's,^/[^/][^/]*,,'`/model"
- else
- CUPS_PPD_DIR="${cups_default_prefix}/share/cups/model"
- fi
-else
- CUPS_PPD_DIR="${with_cupsppddir}"
-fi
-
-
-
-
+CUPS_FILTER_DIR="${prefix}/lib/cups/filter"
+CUPS_PPD_DIR="${prefix}/share/cups/model"
# Check whether --enable-lsb was given.
if test "${enable_lsb+set}" = set; then :

View file

@ -0,0 +1,49 @@
{ lib, stdenv, fetchurl, cups }:
stdenv.mkDerivation {
pname = "epson-escpr";
version = "1.7.16";
src = fetchurl {
# To find new versions, visit
# http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
# some printer like for instance "WF-7110" to get to the most recent
# version.
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download3.ebz.epson.net/dsc/f/03/00/12/97/30/97f146010d33b9a55badbc23429296f6b9b46011/epson-inkjet-printer-escpr-1.7.16-1lsb3.2.tar.gz"
"https://web.archive.org/web/https://download3.ebz.epson.net/dsc/f/03/00/12/97/30/97f146010d33b9a55badbc23429296f6b9b46011/epson-inkjet-printer-escpr-1.7.16-1lsb3.2.tar.gz"
];
sha256 = "18n6fgyrii8084vdjhys94lr6nhhbmn7zzjd8jckvv1grb0iz9nv";
};
patches = [ ./cups-filter-ppd-dirs.patch ];
buildInputs = [ cups ];
meta = with lib; {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
description = "ESC/P-R Driver (generic driver)";
longDescription = ''
Epson Inkjet Printer Driver (ESC/P-R) for Linux and the
corresponding PPD files. The list of supported printers
can be found at http://www.openprinting.org/driver/epson-escpr/ .
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson-escpr ];
};
To setup a wireless printer, enable Avahi which provides
printer's hostname to CUPS and nss-mdns to make this
hostname resolvable:
services.avahi = {
enable = true;
nssmdns = true;
};'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ artuuge ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,55 @@
diff --git a/configure.orig b/configure
index e9d400f..dac1943 100755
--- a/configure.orig
+++ b/configure
@@ -12184,48 +12184,8 @@ esac
# *) ESCPR_LIB_NAME="escpr2_32" ;;
#esac
-
-
-# Check whether --with-cupsfilterdir was given.
-if test "${with_cupsfilterdir+set}" = set; then :
- withval=$with_cupsfilterdir;
-else
- with_cupsfilterdir=no
-fi
-
-if test "xno" = "x${with_cupsfilterdir}"; then
- if test "xyes" = "x$have_cups_config" ; then
- CUPS_FILTER_DIR="${cups_default_prefix}`cups-config --serverbin | sed -e 's,^/[^/][^/]*,,'`/filter"
- else
- CUPS_FILTER_DIR="${cups_default_prefix}/lib/cups/filter"
- fi
-else
- CUPS_FILTER_DIR="${with_cupsfilterdir}"
-fi
-
-
-# Check whether --with-cupsppddir was given.
-if test "${with_cupsppddir+set}" = set; then :
- withval=$with_cupsppddir;
-else
- with_cupsppddir=no
-fi
-
-if test "xno" = "x${with_cupsppddir}"; then
- if test -d "${cups_default_prefix}/share/ppd" ; then
- CUPS_PPD_DIR="${cups_default_prefix}/share/ppd"
- elif test "xyes" = "x$have_cups_config" ; then
- CUPS_PPD_DIR="${cups_default_prefix}`cups-config --datadir | sed -e 's,^/[^/][^/]*,,'`/model"
- else
- CUPS_PPD_DIR="${cups_default_prefix}/share/cups/model"
- fi
-else
- CUPS_PPD_DIR="${with_cupsppddir}"
-fi
-
-
-
-
+CUPS_FILTER_DIR="${prefix}/lib/cups/filter"
+CUPS_PPD_DIR="${prefix}/share/cups/model"
# Check whether --enable-lsb was given.
if test "${enable_lsb+set}" = set; then :

View file

@ -0,0 +1,44 @@
{ lib, stdenv, fetchurl, cups, busybox }:
stdenv.mkDerivation rec {
pname = "epson-inkjet-printer-escpr2";
version = "1.1.46";
src = fetchurl {
# To find new versions, visit
# http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
# some printer like for instance "WF-7210" to get to the most recent
# version.
url = "https://download3.ebz.epson.net/dsc/f/03/00/13/43/83/99e36ae2747bfae54a5dd32dacaf189a073278aa/epson-inkjet-printer-escpr2-1.1.46-1lsb3.2.src.rpm";
sha256 = "sha256-7AeDULD/BB+swLBOwijilcM+yJi5slOMw2lEtquLyYw=";
};
unpackPhase = ''
runHook preUnpack
rpm2cpio $src | cpio -idmv
tar xvf ${pname}-${version}-1lsb3.2.tar.gz
cd ${pname}-${version}
runHook postUnpack
'';
patches = [ ./cups-filter-ppd-dirs.patch ];
buildInputs = [ cups ];
nativeBuildInputs = [ busybox ];
meta = with lib; {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
description = "ESC/P-R 2 Driver (generic driver)";
longDescription = ''
Epson Inkjet Printer Driver 2 (ESC/P-R 2) for Linux and the
corresponding PPD files.
Refer to the description of epson-escpr for usage.
'';
license = licenses.gpl2;
maintainers = with maintainers; [ ma9e ma27 ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,102 @@
{
autoreconfHook, cups, libjpeg, rpmextract,
fetchurl, lib, stdenv
}:
let
srcdirs = {
filter = "epson-inkjet-printer-filter-1.0.0";
driver = "epson-inkjet-printer-workforce-635-nx625-series-1.0.1";
};
in stdenv.mkDerivation rec {
pname = "epson-inkjet-printer-workforce-635-nx625-series";
version = "1.0.1";
src = fetchurl {
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
"https://web.archive.org/web/https://download.ebz.epson.net/dsc/op/stable/SRPMS/${pname}-${version}-1lsb3.2.src.rpm"
];
sha256 = "19nb2h0y9rvv6rg7j262f8sqap9kjvz8kmisxnjg1w0v19zb9zf2";
};
sourceRoot = srcdirs.filter;
nativeBuildInputs = [ autoreconfHook rpmextract ];
buildInputs = [ cups libjpeg ];
unpackPhase = ''
rpmextract "$src"
for i in ${lib.concatStringsSep " " (builtins.attrValues srcdirs)}; do
tar xvf "$i".tar.gz
done
'';
preConfigure = ''
chmod u+x configure
'';
installPhase =
let
filterdir = "$out/cups/lib/filter";
docdir = "$out/share/doc";
ppddir = "$out/share/cups/model/${pname}";
libdir =
if stdenv.system == "x86_64-linux" then "lib64"
else if stdenv.system == "i686_linux" then "lib"
else throw "other platforms than i686_linux and x86_64-linux are not yet supported";
in ''
mkdir -p "$out" "${docdir}" "${filterdir}" "${ppddir}"
cp src/epson_inkjet_printer_filter "${filterdir}"
cd ../${srcdirs.driver}
for ppd in ppds/*; do
substituteInPlace "$ppd" --replace '/opt/${pname}' "$out"
gzip -c "$ppd" > "${ppddir}/''${ppd#*/}"
done
cp COPYING.EPSON README "${docdir}"
cp -r resource watermark ${libdir} "$out"
'';
meta = {
description = "Proprietary CUPS drivers for Epson inkjet printers";
longDescription = ''
This software is a filter program used with Common UNIX Printing
System (CUPS) from the Linux. This can supply the high quality print
with Seiko Epson Color Ink Jet Printers.
This printer driver is supporting the following printers.
WorkForce 60
WorkForce 625
WorkForce 630
WorkForce 633
WorkForce 635
WorkForce T42WD
Epson Stylus NX625
Epson Stylus SX525WD
Epson Stylus SX620FW
Epson Stylus TX560WD
Epson Stylus Office B42WD
Epson Stylus Office BX525WD
Epson Stylus Office BX625FWD
Epson Stylus Office TX620FWD
Epson ME OFFICE 82WD
Epson ME OFFICE 85ND
Epson ME OFFICE 900WD
Epson ME OFFICE 960FWD
License: LGPL and SEIKO EPSON CORPORATION SOFTWARE LICENSE AGREEMENT
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.${pname} ];
};
'';
downloadPage = "https://download.ebz.epson.net/dsc/du/02/DriverDownloadInfo.do?LG2=EN&CN2=&DSCMI=16857&DSCCHK=4334d3487503d7f916ccf5d58071b05b7687294f";
license = with lib.licenses; [ lgpl21 epson ];
maintainers = [ lib.maintainers.jorsn ];
platforms = [ "x86_64-linux" "i686-linux" ];
};
}

View file

@ -0,0 +1,77 @@
{ lib, stdenv, fetchurl, rpmextract, autoreconfHook, file, libjpeg, cups }:
let
version = "1.0.0";
in
stdenv.mkDerivation {
pname = "epson_201207w";
inherit version;
src = fetchurl {
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201207w-${version}-1lsb3.2.src.rpm"
"https://web.archive.org/web/https://download.ebz.epson.net/dsc/op/stable/SRPMS/epson-inkjet-printer-201207w-${version}-1lsb3.2.src.rpm"
];
sha256 = "1ixnhn2dk83nh9v8sdivzgc2bm9z2phvsbx8bc6ainbjq6vn7lns";
};
nativeBuildInputs = [ rpmextract autoreconfHook file ];
buildInputs = [ libjpeg cups ];
unpackPhase = ''
rpmextract $src
tar -zxf epson-inkjet-printer-201207w-${version}.tar.gz
tar -zxf epson-inkjet-printer-filter-${version}.tar.gz
for ppd in epson-inkjet-printer-201207w-${version}/ppds/*; do
substituteInPlace $ppd --replace "/opt/epson-inkjet-printer-201207w" "$out"
substituteInPlace $ppd --replace "/cups/lib" "/lib/cups"
done
cd epson-inkjet-printer-filter-${version}
'';
preConfigure = ''
chmod +x configure
export LDFLAGS="$LDFLAGS -Wl,--no-as-needed"
'';
postInstall = ''
cd ../epson-inkjet-printer-201207w-${version}
cp -a lib64 resource watermark $out
mkdir -p $out/share/cups/model/epson-inkjet-printer-201207w
cp -a ppds $out/share/cups/model/epson-inkjet-printer-201207w/
cp -a Manual.txt $out/doc/
cp -a README $out/doc/README.driver
'';
meta = with lib; {
homepage = "https://www.openprinting.org/driver/epson-201207w";
description = "Epson printer driver (L110, L210, L300, L350, L355, L550, L555)";
longDescription = ''
This software is a filter program used with the Common UNIX Printing
System (CUPS) under Linux. It supplies high quality printing with
Seiko Epson Color Ink Jet Printers.
List of printers supported by this package:
Epson L110 Series
Epson L210 Series
Epson L300 Series
Epson L350 Series
Epson L355 Series
Epson L550 Series
Epson L555 Series
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson_201207w ];
};
'';
license = with licenses; [ lgpl21 epson ];
maintainers = [ maintainers.romildo ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,72 @@
{ lib, stdenv, fetchurl, foomatic-filters, bc, ghostscript, systemd, vim, time }:
stdenv.mkDerivation rec {
pname = "foo2zjs";
version = "20210116";
src = fetchurl {
url = "http://www.loegria.net/mirrors/foo2zjs/foo2zjs-${version}.tar.gz";
sha256 = "14x3wizvncdy0xgvmcx541qanwb7bg76abygqy17bxycn1zh5r1x";
};
buildInputs = [ foomatic-filters bc ghostscript systemd vim ];
patches = [
./no-hardcode-fw.diff
# Support HBPL1 printers https://www.dechifro.org/hbpl/
./hbpl1.patch
# Fix "Unimplemented paper code" error for hbpl1 printers
# https://github.com/mikerr/foo2zjs/pull/2
./papercode-format-fix.patch
];
makeFlags = [
"PREFIX=$(out)"
"APPL=$(out)/share/applications"
"PIXMAPS=$(out)/share/pixmaps"
"UDEVBIN=$(out)/bin"
"UDEVDIR=$(out)/etc/udev/rules.d"
"UDEVD=${systemd}/sbin/udevd"
"LIBUDEVDIR=$(out)/lib/udev/rules.d"
"USBDIR=$(out)/etc/hotplug/usb"
"FOODB=$(out)/share/foomatic/db/source"
"MODEL=$(out)/share/cups/model"
];
installFlags = [ "install-hotplug" ];
postPatch = ''
touch all-test
sed -e "/BASENAME=/iPATH=$out/bin:$PATH" -i *-wrapper *-wrapper.in
sed -e "s@PREFIX=/usr@PREFIX=$out@" -i *-wrapper{,.in}
sed -e "s@/usr/share@$out/share@" -i hplj10xx_gui.tcl
sed -e "s@\[.*-x.*/usr/bin/logger.*\]@type logger >/dev/null 2>\&1@" -i *wrapper{,.in}
sed -e '/install-usermap/d' -i Makefile
sed -e "s@/etc/hotplug/usb@$out&@" -i *rules*
sed -e "s@/usr@$out@g" -i hplj1020.desktop
sed -e "/PRINTERID=/s@=.*@=$out/bin/usb_printerid@" -i hplj1000
'';
checkInputs = [ time ];
doCheck = false; # fails to find its own binary. Also says "Tests will pass only if you are using ghostscript-8.71-16.fc14".
preInstall = ''
mkdir -pv $out/{etc/udev/rules.d,lib/udev/rules.d,etc/hotplug/usb}
mkdir -pv $out/share/foomatic/db/source/{opt,printer,driver}
mkdir -pv $out/share/cups/model
mkdir -pv $out/share/{applications,pixmaps}
mkdir -pv "$out/bin"
cp -v getweb arm2hpdl "$out/bin"
'';
meta = with lib; {
description = "ZjStream printer drivers";
maintainers = with maintainers;
[
raskin
];
platforms = platforms.linux;
license = licenses.gpl2Plus;
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,98 @@
#
#
# patch "hplj1000"
# from [d5336e74866d31735d97874191351a0dcc092b44]
# to [55102b37684ee5181674d19d866caec2cf603412]
#
============================================================
--- a/hplj1000 d5336e74866d31735d97874191351a0dcc092b44
+++ b/hplj1000 55102b37684ee5181674d19d866caec2cf603412
@@ -39,11 +39,6 @@ DEV=""
DEV=""
#
-# Directory to find downloadable HP firmware files sihpMMMM.dl
-#
-FWDIR=/usr/share/foo2zjs/firmware
-
-#
# Program used to determine USB printer id information
#
# NOTE: /usr/bin is NOT mounted at this point
@@ -83,57 +78,61 @@ case "$0" in
MODEL=P1005; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x3d17 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*P1006)
MODEL=P1006; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x3e17 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*P1007)
MODEL=P1007; FWMODEL=P1005 # Alias
USB1=0x03f0 #Vendor
USB2=0x4817 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*P1008)
MODEL=P1008; FWMODEL=P1006 # Alias
USB1=0x03f0 #Vendor
USB2=0x4917 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*P1505)
MODEL=P1505; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x3f17 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*P1505n)
MODEL=P1505n; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x4017 #Model
- FWDIR=/usr/share/foo2xqx/firmware
+ DRIVER=foo2xqx
;;
*1000)
MODEL=1000; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x0517 #Model
+ DRIVER=foo2zjs
;;
*1005)
MODEL=1005; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x1317 #Model
+ DRIVER=foo2zjs
;;
*1018)
MODEL=1018; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x4117 #Model
+ DRIVER=foo2zjs
;;
*1020)
MODEL=1020; FWMODEL=$MODEL
USB1=0x03f0 #Vendor
USB2=0x2b17 #Model
+ DRIVER=foo2zjs
;;
*)
log "Only HP LaserJet 100[05],1018,1020,P100[5678],P1505 are supported"
@@ -203,7 +202,7 @@ load1() {
#
load1() {
_dev="$1"
- fw="$FWDIR/sihp$FWMODEL.dl"
+ fw="${FOO2ZJS_DATADIR:-/usr/share}/$DRIVER/firmware/sihp$FWMODEL.dl"
if [ ! -f "$fw" ]; then
log "Missing HP LaserJet $MODEL firmware file $fw"
log "...read foo2zjs installation instructions and run ./getweb $MODEL"

View file

@ -0,0 +1,101 @@
From 29ac95ac76a9d9977561cef352f8b803579fea2a Mon Sep 17 00:00:00 2001
From: Shinbar <richard.shine@gmail.com>
Date: Thu, 26 Mar 2020 19:33:39 +0000
Subject: [PATCH 1/3] PPDs (e.g. Del-1660.ppd) are specifying paper sizes as
parameters e.g. -p1 which are then being picked up as an invalid paper size
In cups error_log manifesting as: foo2hbpl1-wrapper: Unimplemented paper code
1
Have amended foo2hbpl1-wrapper.in to intepret paper sizes
paper parameters are also now being interpreted.
This has fixed for a Dell 1660w printer, running on Ubuntu 18.04
---
foo2hbpl1-wrapper.in | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/foo2hbpl1-wrapper.in b/foo2hbpl1-wrapper.in
index 567e891..bb20ed5 100644
--- a/foo2hbpl1-wrapper.in
+++ b/foo2hbpl1-wrapper.in
@@ -341,20 +341,20 @@ Custom*)
# /usr/share/ghostscript/9.10/Resource/Init/gs_statd.ps
# foo2hbpl1 will provide the appropriate numeric value
-letter) DIM=5100x6600 ;;
-legal) DIM=5100x8400 ;;
-a4) DIM=4961x7016 ;;
-executive) DIM=4350x6300 ;;
-env10) DIM=2475x5700 ;;
-monarch) DIM=2325x4500 ;;
-c5) DIM=3827x5409 ;;
-envDL) DIM=2599x5197 ;;
-isob5|b5) DIM=4158x5906 ;;
-jisb5) DIM=4299x6071 ;;
-a5) DIM=3496x4961 ;;
-folio) DIM=5100x7800 ;;
-pa4) DIM=4961x6600 ;;
-archA) DIM=5400x7200 ;;
+4|letter|Letter) DIM=5100x6600 ;;
+7|legal|Legal) DIM=5100x8400 ;;
+1|a4|A4) DIM=4961x7016 ;;
+5|executive|Executive) DIM=4350x6300 ;;
+9|env10|Env10) DIM=2475x5700 ;;
+10|monarch|EnvMonarch) DIM=2325x4500 ;;
+11|c5|EnvC5) DIM=3827x5409 ;;
+12|envDL|EnvDL) DIM=2599x5197 ;;
+isob5|b5) DIM=4158x5906 ;;
+2|jisb5|B5jis) DIM=4299x6071 ;;
+a5) DIM=3496x4961 ;;
+6|folio|Folio) DIM=5100x7800 ;;
+pa4) DIM=4961x6600 ;;
+archA) DIM=5400x7200 ;;
*) error "Unimplemented paper code $PAPER";;
esac
From 289d55ded5af7d84a91b0ecf26bbea18f3cb2d9e Mon Sep 17 00:00:00 2001
From: Shinbar <richard.shine@gmail.com>
Date: Fri, 27 Mar 2020 09:19:40 +0000
Subject: [PATCH 2/3] Added A5 paper size parameter
---
foo2hbpl1-wrapper.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/foo2hbpl1-wrapper.in b/foo2hbpl1-wrapper.in
index bb20ed5..474972d 100644
--- a/foo2hbpl1-wrapper.in
+++ b/foo2hbpl1-wrapper.in
@@ -351,7 +351,7 @@ Custom*)
12|envDL|EnvDL) DIM=2599x5197 ;;
isob5|b5) DIM=4158x5906 ;;
2|jisb5|B5jis) DIM=4299x6071 ;;
-a5) DIM=3496x4961 ;;
+3|a5|A5) DIM=3496x4961 ;;
6|folio|Folio) DIM=5100x7800 ;;
pa4) DIM=4961x6600 ;;
archA) DIM=5400x7200 ;;
From 393f7a7c70bbf9fa0c39ac1504b220793670d201 Mon Sep 17 00:00:00 2001
From: Shinbar <richard.shine@gmail.com>
Date: Sun, 29 Mar 2020 10:01:31 +0100
Subject: [PATCH 3/3] Makefile now works in FreeBSD
---
osx-hotplug/Makefile | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/osx-hotplug/Makefile b/osx-hotplug/Makefile
index 4165085..a9aa06a 100644
--- a/osx-hotplug/Makefile
+++ b/osx-hotplug/Makefile
@@ -64,8 +64,5 @@ clean:
rm -f *.o *.1
uninstall:
- ( \
- echo "g/osx-hplj-hotplug/d"; \
- echo "w"; \
- ) | ex $(RC)
+ -(echo "g/osx-hplj-hotplug/d"; echo "w") | ex $(RC)
-rm -f $(BIN)/osx-hplj-hotplug

View file

@ -0,0 +1,47 @@
{ lib, stdenv, fetchpatch, fetchurl, pkg-config, perl, cups, dbus, enscript }:
stdenv.mkDerivation rec {
pname = "foomatic-filters";
version = "4.0.17";
src = fetchurl {
url = "https://www.openprinting.org/download/foomatic/foomatic-filters-${version}.tar.gz";
sha256 = "1qrkgbm5jay2r7sh9qbyf0aiyrsl1mdc844hxf7fhw95a0zfbqm2";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ perl cups dbus enscript ];
patches = [
(fetchpatch {
name = "CVE-2015-8327+CVE-2015-8560.patch";
url = "https://salsa.debian.org/debian/foomatic-filters/raw/a3abbef2d2f8c7e62d2fe64f64afe294563fdf8f/debian/patches/0500-r7406_also_consider_the_back_tick_as_an_illegal_shell_escape_character.patch";
sha256 = "055nwi3sjf578nk40bqsch3wx8m2h65hdih0wmxflb6l0hwkq4p4";
})
];
preConfigure =
''
substituteInPlace foomaticrip.c --replace /bin/bash ${stdenv.shell}
'';
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
# ld: foomatic_rip-options.o:/build/foomatic-filters-4.0.17/options.c:49: multiple definition of
# `cupsfilter'; foomatic_rip-foomaticrip.o:/build/foomatic-filters-4.0.17/foomaticrip.c:158: first defined here
NIX_CFLAGS_COMPILE = "-fcommon";
installTargets = [ "install-cups" ];
installFlags = [
"CUPS_FILTERS=$(out)/lib/cups/filter"
"CUPS_BACKENDS=$(out)/lib/cups/backend"
];
meta = {
description = "Foomatic printing filters";
maintainers = [ lib.maintainers.raskin ];
platforms = lib.platforms.linux;
license = lib.licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,69 @@
{ lib, stdenv, fetchurl, rpm, cpio, zlib }:
/* usage: (sorry, its still impure but works!)
impure directory:
mkdir /opt/gutenprint; sudo cp -r $(nix-build -A gutenprintBin -f $NIXPGS_ALL) /opt/gutenprint
add the following lines to bindirCmds property of printing/cupsd.nix:
ln -s ${pkgs.gutenprintBin}/lib/cups/backend/* $out/lib/cups/backend/
ln -s ${pkgs.gutenprintBin}/lib/cups/filter/* $out/lib/cups/filter/
mkdir -p $out/lib/cups/model
cat ${pkgs.gutenprintBin}/ppds/Canon/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd.gz |gunzip > $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
sed -i 's@/opt/gutenprint/cups@${pkgs.gutenprintBin}/cups@' $out/lib/cups/model/Canon-PIXMA_iP4000-gutenprint.5.0.sim-en.ppd
Then rebuild your system and add your printer using the the localhost:603 cups web interface
select the extracted .ppd file which can be found in the model directory of
sed -n 's/^ServerBin //p' $(sed -n 's/respawn.*-c \(.*''\) -F.*''/\1/p' /etc/event.d/cupsd)
(sorry, cups still doesn't see it. You could copy it into /nix/store/
*-cups/lib/cups/model/ and you would be able to select canon -> PIXMA 4000
then. I've tried that.
TODO tidy this all up. Find source instead of binary. Fix paths ... Find out how to check ink levels etc
*/
stdenv.mkDerivation {
pname = "cups-gutenprint-binary";
version = "5.0.1";
src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
url = "https://www.openprinting.org/download/printdriver/debian/dists/lsb3.1/main/binary-amd64/gutenprint_5.0.1-1lsb3.1_amd64.deb";
sha256 = "0an5gba6r6v54r53s2gj2fjk8fzpl4lrksjas2333528b0k8gbbc";
} else throw "TODO"; # get from openprint.com -> drivers -> gutenprint
buildInputs = [ rpm cpio ];
dontUnpack = true;
dontInstall = true;
dontFixup = true;
libPath = lib.makeLibraryPath [ stdenv.cc.cc zlib ];
buildPhase = ''
ar -x $src data.tar.gz
tar xfz data.tar.gz
cp -r opt/gutenprint $out
for p in \
$out/cups/lib/driver/gutenprint.5.0 \
$out/bin/{escputil,cups-calibrate} \
$out/cups/lib/driver/gutenprint.5.0 \
$out/cups/lib/filter/{rastertogutenprint.5.0,commandtocanon,commandtoepson} \
$out/cups/lib/backend/{canon,epson} \
$out/sbin/cups-genppd.5.0 \
; do
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $libPath $p
done
mkdir $out/lib
ln -s $out/cups/lib $out/lib/cups
'';
meta = {
description = "Some additional CUPS drivers including Canon drivers";
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,53 @@
# this package was called gimp-print in the past
{ stdenv, lib, fetchurl, makeWrapper, pkg-config
, ijs, zlib
, gimp2Support ? false, gimp
, cupsSupport ? true, cups, libusb-compat-0_1, perl
}:
stdenv.mkDerivation rec {
pname = "gutenprint";
version = "5.3.4";
src = fetchurl {
url = "mirror://sourceforge/gimp-print/gutenprint-${version}.tar.bz2";
sha256 = "0s0b14hjwvbxksq7af5v8z9g2rfqv9jdmxd9d81m57f5mh6rad0p";
};
nativeBuildInputs = [ makeWrapper pkg-config ];
buildInputs =
[ ijs zlib ]
++ lib.optionals gimp2Support [ gimp.gtk gimp ]
++ lib.optionals cupsSupport [ cups libusb-compat-0_1 perl ];
configureFlags = lib.optionals cupsSupport [
"--disable-static-genppd" # should be harmless on NixOS
];
# FIXME: hacky because we modify generated configure, but I haven't found a better way.
# makeFlags doesn't change this everywhere (e.g. in cups-genppdupdate).
preConfigure = lib.optionalString cupsSupport ''
sed -i \
-e "s,cups_conf_datadir=.*,cups_conf_datadir=\"$out/share/cups\",g" \
-e "s,cups_conf_serverbin=.*,cups_conf_serverbin=\"$out/lib/cups\",g" \
-e "s,cups_conf_serverroot=.*,cups_conf_serverroot=\"$out/etc/cups\",g" \
configure
'' + lib.optionalString gimp2Support ''
sed -i \
-e "s,gimp2_plug_indir=.*,gimp2_plug_indir=\"$out/lib/gimp/${gimp.majorVersion}\",g" \
configure
'';
enableParallelBuilding = true;
# Testing is very, very long.
# doCheck = true;
meta = with lib; {
description = "Ghostscript and cups printer drivers";
homepage = "https://sourceforge.net/projects/gimp-print/";
license = licenses.gpl2;
platforms = platforms.linux;
isGutenprint = true;
};
}

View file

@ -0,0 +1,266 @@
{ lib, stdenv, fetchurl, substituteAll
, pkg-config
, cups, zlib, libjpeg, libusb1, python3Packages, sane-backends
, dbus, file, ghostscript, usbutils
, net-snmp, openssl, perl, nettools, avahi
, bash, util-linux
# To remove references to gcc-unwrapped
, removeReferencesTo, qt5
, withQt5 ? true
, withPlugin ? false
, withStaticPPDInstall ? false
}:
let
pname = "hplip";
version = "3.21.12";
src = fetchurl {
url = "mirror://sourceforge/hplip/${pname}-${version}.tar.gz";
sha256 = "sha256-fvRSPvgbztcVFeHIhA72xoxgJjjBWebdmpJpHO7GT5w=";
};
plugin = fetchurl {
url = "https://developers.hp.com/sites/default/files/${pname}-${version}-plugin.run";
sha256 = "sha256-eyYNhuff8mM4IpRfn/fLBjQJ23JrTdsHBQ/EH7Ug0gw=";
};
hplipState = substituteAll {
inherit version;
src = ./hplip.state;
};
hplipPlatforms = {
i686-linux = "x86_32";
x86_64-linux = "x86_64";
armv6l-linux = "arm32";
armv7l-linux = "arm32";
aarch64-linux = "arm64";
};
hplipArch = hplipPlatforms.${stdenv.hostPlatform.system}
or (throw "HPLIP not supported on ${stdenv.hostPlatform.system}");
pluginArches = [ "x86_32" "x86_64" "arm32" "arm64" ];
in
assert withPlugin -> builtins.elem hplipArch pluginArches
|| throw "HPLIP plugin not supported on ${stdenv.hostPlatform.system}";
python3Packages.buildPythonApplication {
inherit pname version src;
format = "other";
buildInputs = [
libjpeg
cups
libusb1
sane-backends
dbus
file
ghostscript
net-snmp
openssl
perl
zlib
avahi
];
nativeBuildInputs = [
pkg-config
removeReferencesTo
] ++ lib.optional withQt5 qt5.wrapQtAppsHook;
pythonPath = with python3Packages; [
dbus
pillow
pygobject3
reportlab
usbutils
sip_4
dbus-python
distro
] ++ lib.optionals withQt5 [
pyqt5
pyqt5_sip
enum-compat
];
makeWrapperArgs = [ "--prefix" "PATH" ":" "${nettools}/bin" ];
patches = [
# HPLIP's getSystemPPDs() function relies on searching for PPDs below common FHS
# paths, and hp-setup crashes if none of these paths actually exist (which they
# don't on NixOS). Add the equivalent NixOS path, /var/lib/cups/path/share.
# See: https://github.com/NixOS/nixpkgs/issues/21796
./hplip-3.20.11-nixos-cups-ppd-search-path.patch
];
postPatch = ''
# https://github.com/NixOS/nixpkgs/issues/44230
substituteInPlace createPPD.sh \
--replace ppdc "${cups}/bin/ppdc" \
--replace "gzip -c" "gzip -cn"
# HPLIP hardcodes absolute paths everywhere. Nuke from orbit.
find . -type f -exec sed -i \
-e s,/etc/hp,$out/etc/hp,g \
-e s,/etc/sane.d,$out/etc/sane.d,g \
-e s,/usr/include/libusb-1.0,${libusb1.dev}/include/libusb-1.0,g \
-e s,/usr/share/hal/fdi/preprobe/10osvendor,$out/share/hal/fdi/preprobe/10osvendor,g \
-e s,/usr/lib/systemd/system,$out/lib/systemd/system,g \
-e s,/var/lib/hp,$out/var/lib/hp,g \
-e s,/usr/bin/perl,${perl}/bin/perl,g \
-e s,/usr/bin/file,${file}/bin/file,g \
-e s,/usr/bin/gs,${ghostscript}/bin/gs,g \
-e s,/usr/share/cups/fonts,${ghostscript}/share/ghostscript/fonts,g \
-e "s,ExecStart=/usr/bin/python /usr/bin/hp-config_usb_printer,ExecStart=$out/bin/hp-config_usb_printer,g" \
{} +
'';
configureFlags = let out = placeholder "out"; in
[
"--with-hpppddir=${out}/share/cups/model/HP"
"--with-cupsfilterdir=${out}/lib/cups/filter"
"--with-cupsbackenddir=${out}/lib/cups/backend"
"--with-icondir=${out}/share/applications"
"--with-systraydir=${out}/xdg/autostart"
"--with-mimedir=${out}/etc/cups"
"--enable-policykit"
"--disable-qt4"
# remove ImageProcessor usage, it causes segfaults, see
# https://bugs.launchpad.net/hplip/+bug/1788706
# https://bugs.launchpad.net/hplip/+bug/1787289
"--disable-imageProcessor-build"
]
++ lib.optional withStaticPPDInstall "--enable-cups-ppd-install"
++ lib.optional withQt5 "--enable-qt5"
;
# Prevent 'ppdc: Unable to find include file "<font.defs>"' which prevent
# generation of '*.ppd' files.
# This seems to be a 'ppdc' issue when the tool is run in a hermetic sandbox.
# Could not find how to fix the problem in 'ppdc' so this is a workaround.
CUPS_DATADIR = "${cups}/share/cups";
makeFlags = let out = placeholder "out"; in [
"halpredir=${out}/share/hal/fdi/preprobe/10osvendor"
"rulesdir=${out}/etc/udev/rules.d"
"policykit_dir=${out}/share/polkit-1/actions"
"policykit_dbus_etcdir=${out}/etc/dbus-1/system.d"
"policykit_dbus_sharedir=${out}/share/dbus-1/system-services"
"hplip_confdir=${out}/etc/hp"
"hplip_statedir=${out}/var/lib/hp"
];
postConfigure = ''
# don't save timestamp, in order to improve reproducibility
substituteInPlace Makefile \
--replace "GZIP_ENV = --best" "GZIP_ENV = --best -n"
'';
enableParallelBuilding = true;
#
# Running `hp-diagnose_plugin -g` can be used to diagnose
# issues with plugins.
#
postInstall = lib.optionalString withPlugin ''
sh ${plugin} --noexec --keep
cd plugin_tmp
cp plugin.spec $out/share/hplip/
mkdir -p $out/share/hplip/data/firmware
cp *.fw.gz $out/share/hplip/data/firmware
mkdir -p $out/share/hplip/data/plugins
cp license.txt $out/share/hplip/data/plugins
mkdir -p $out/share/hplip/prnt/plugins
for plugin in lj hbpl1; do
cp $plugin-${hplipArch}.so $out/share/hplip/prnt/plugins
chmod 0755 $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so
ln -s $out/share/hplip/prnt/plugins/$plugin-${hplipArch}.so \
$out/share/hplip/prnt/plugins/$plugin.so
done
mkdir -p $out/share/hplip/scan/plugins
for plugin in bb_soap bb_marvell bb_soapht bb_escl; do
cp $plugin-${hplipArch}.so $out/share/hplip/scan/plugins
chmod 0755 $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so
ln -s $out/share/hplip/scan/plugins/$plugin-${hplipArch}.so \
$out/share/hplip/scan/plugins/$plugin.so
done
mkdir -p $out/share/hplip/fax/plugins
for plugin in fax_marvell; do
cp $plugin-${hplipArch}.so $out/share/hplip/fax/plugins
chmod 0755 $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so
ln -s $out/share/hplip/fax/plugins/$plugin-${hplipArch}.so \
$out/share/hplip/fax/plugins/$plugin.so
done
mkdir -p $out/var/lib/hp
cp ${hplipState} $out/var/lib/hp/hplip.state
'';
# The installed executables are just symlinks into $out/share/hplip,
# but wrapPythonPrograms ignores symlinks. We cannot replace the Python
# modules in $out/share/hplip with wrapper scripts because they import
# each other as libraries. Instead, we emulate wrapPythonPrograms by
# 1. Calling patchPythonProgram on the original script in $out/share/hplip
# 2. Making our own wrapper pointing directly to the original script.
dontWrapPythonPrograms = true;
preFixup = ''
buildPythonPath "$out $pythonPath"
for bin in $out/bin/*; do
py=$(readlink -m $bin)
rm $bin
echo "patching \`$py'..."
patchPythonScript "$py"
echo "wrapping \`$bin'..."
makeWrapper "$py" "$bin" \
--prefix PATH ':' "$program_PATH" \
--set PYTHONNOUSERSITE "true" \
$makeWrapperArgs
done
'';
postFixup = ''
substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out
# Patch udev rules:
# with plugin, they upload firmware to printers,
# without plugin, they complain about the missing plugin.
substituteInPlace $out/etc/udev/rules.d/56-hpmud.rules \
--replace {,${bash}}/bin/sh \
--replace /usr/bin/nohup "" \
--replace {,${util-linux}/bin/}logger \
--replace {/usr,$out}/bin
remove-references-to -t ${stdenv.cc.cc} $(readlink -f $out/lib/*.so)
'' + lib.optionalString withQt5 ''
for f in $out/bin/hp-*;do
wrapQtApp $f
done
'';
# There are some binaries there, which reference gcc-unwrapped otherwise.
stripDebugList = [
"share/hplip" "lib/cups/backend" "lib/cups/filter" python3Packages.python.sitePackages "lib/sane"
];
meta = with lib; {
description = "Print, scan and fax HP drivers for Linux";
homepage = "https://developers.hp.com/hp-linux-imaging-and-printing";
downloadPage = "https://sourceforge.net/projects/hplip/files/hplip/";
license = if withPlugin
then licenses.unfree
else with licenses; [ mit bsd2 gpl2Plus ];
platforms = [ "i686-linux" "x86_64-linux" "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
maintainers = with maintainers; [ ttuegel ];
};
}

View file

@ -0,0 +1,24 @@
From: Bryan Gardiner <bog@khumba.net>
Date: Sat, 9 Jan 2021 16:51:20 -0800
Subject: [PATCH] Add NixOS CUPS PPD search path.
---
base/g.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/base/g.py b/base/g.py
index f73e23f..758f339 100644
--- a/base/g.py
+++ b/base/g.py
@@ -283,7 +283,7 @@ prop.max_message_len = 8192
prop.max_message_read = 65536
prop.read_timeout = 90
-prop.ppd_search_path = '/usr/share;/usr/local/share;/usr/lib;/usr/local/lib;/usr/libexec;/opt;/usr/lib64'
+prop.ppd_search_path = '/var/lib/cups/path/share;/usr/share;/usr/local/share;/usr/lib;/usr/local/lib;/usr/libexec;/opt;/usr/lib64'
prop.ppd_search_pattern = 'HP-*.ppd.*'
prop.ppd_download_url = 'http://www.linuxprinting.org/ppd-o-matic.cgi'
prop.ppd_file_suffix = '-hpijs.ppd'
--
2.29.2

View file

@ -0,0 +1,4 @@
[plugin]
installed=1
eula=1
version=@version@

View file

@ -0,0 +1,60 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, libftdi
, infnoise, testers }:
stdenv.mkDerivation rec {
pname = "infnoise";
version = "0.3.2";
src = fetchFromGitHub {
owner = "leetronics";
repo = "infnoise";
rev = "e80ddd78085abf3d06df2e0d8c08fd33dade78eb";
sha256 = "sha256-9MKG1InkV+yrQPBTgi2gZJ3y9Fokb6WbxuAnM7n7FyA=";
};
patches = [
# Patch makefile so we can set defines from the command line instead of it depending on .git
./makefile.patch
# Fix getc return type
(fetchpatch {
url = "https://github.com/leetronics/infnoise/commit/7ed7014e14253311c07e530c8f89f1c8f4705c2b.patch";
sha256 = "sha256-seB/fJaxQ/rXJp5iPtnobXXOccQ2KUAk6HFx31dhOhs=";
})
];
GIT_COMMIT = src.rev;
GIT_VERSION = version;
GIT_DATE = "2019-08-12";
buildInputs = [ libftdi ];
makefile = "Makefile.linux";
makeFlags = [ "PREFIX=$(out)" ];
postPatch = ''
cd software
substituteInPlace init_scripts/infnoise.service --replace "/usr/local" "$out"
'';
postInstall = ''
make -C tools
find ./tools/ -executable -type f -exec \
sh -c "install -Dm755 {} $out/bin/infnoise-\$(basename {})" \;
'';
passthru = {
tests.version = testers.testVersion { package = infnoise; };
};
meta = with lib; {
homepage = "https://github.com/leetronics/infnoise";
description = "Driver for the Infinite Noise TRNG";
longDescription = ''
The Infinite Noise TRNG is a USB key hardware true random number generator.
It can either provide rng for userland applications, or provide rng for the OS entropy.
'';
license = licenses.cc0;
maintainers = with maintainers; [ StijnDW zhaofengli ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,14 @@
diff --git a/software/Makefile.linux b/software/Makefile.linux
index db48aa5..df8b3d2 100644
--- a/software/Makefile.linux
+++ b/software/Makefile.linux
@@ -1,6 +1,6 @@
-GIT_VERSION := $(shell git --no-pager describe --tags --always)
-GIT_COMMIT := $(shell git rev-parse --verify HEAD)
-GIT_DATE := $(firstword $(shell git --no-pager show --date=iso-strict --format="%ad" --name-only))
+GIT_VERSION ?= $(shell git --no-pager describe --tags --always)
+GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
+GIT_DATE ?= $(firstword $(shell git --no-pager show --date=iso-strict --format="%ad" --name-only))
PREFIX = $(DESTDIR)/usr/local

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, cmake, udev, libevdev, libconfig }:
stdenv.mkDerivation rec {
pname = "logiops";
version = "0.2.3";
src = fetchFromGitHub {
owner = "pixlone";
repo = "logiops";
rev = "v${version}";
sha256 = "sha256-1v728hbIM2ODtB+r6SYzItczRJCsbuTvhYD2OUM1+/E=";
};
PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [ udev libevdev libconfig ];
meta = with lib; {
description = "Unofficial userspace driver for HID++ Logitech devices";
homepage = "https://github.com/PixlOne/logiops";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ckie ];
platforms = with platforms; linux;
};
}

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchFromGitHub }:
stdenv.mkDerivation {
pname = "M33-Linux";
version = "unstable-2016-06-23";
src = fetchFromGitHub {
owner = "donovan6000";
repo = "M3D-Linux";
rev = "5c1b90c13d260771dac970b49fdc9f840fee5f4a";
sha256 = "1bvbclkyfcv23vxb4s1zssvygklks1nhp4iwi4v90c1fvyz0356f";
};
installPhase = ''
install -Dm755 m33-linux $out/bin/m33-linux
install -Dm755 90-micro-3d-local.rules $out/lib/udev/rules.d/90-micro-3d-local.rules
'';
meta = with lib; {
homepage = "https://github.com/donovan6000/M3D-Linux";
description = "A Linux program that can communicate with the Micro 3D printer";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ abbradar ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, udev }:
stdenv.mkDerivation {
pname = "moltengamepad";
version = "unstable-2016-05-04";
src = fetchFromGitHub {
owner = "jgeumlek";
repo = "MoltenGamepad";
rev = "6656357964c22be97227fc5353b53c6ab1e69929";
sha256 = "05cpxfzxgm86kxx0a9f76bshjwpz9w1g8bn30ib1i5a3fv7bmirl";
};
hardeningDisable = [ "format" ];
buildInputs = [ udev ];
buildPhase = ''
make
'';
installPhase = ''
mkdir -p $out/bin
cp moltengamepad $out/bin
'';
patchPhase = ''
sed -i -e '159d;161d;472d;473d;474d;475d' source/eventlists/key_list.cpp
'';
meta = with lib; {
homepage = "https://github.com/jgeumlek/MoltenGamepad";
description = "Flexible Linux input device translator, geared for gamepads";
license = licenses.mit;
maintainers = [ maintainers.ebzzry ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,52 @@
{ lib
, stdenv
, fetchzip
, libusb1
, cups
, dpkg
, libjpeg8
, makeWrapper
, autoPatchelfHook
, enablePtqpdf ? false # Pantum's version of qpdf
}:
let
architecture = {
i686-linux = "i386";
x86_64-linux = "amd64";
}.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
in
stdenv.mkDerivation rec {
pname = "pantum-driver";
version = "1.1.84";
src = fetchzip {
url = "https://drivers.pantum.com/Pantum_Ubuntu_Driver_V${version}_1.zip";
sha256 = "sha256-UJzYBsGj/TMhQoMourx7UPGBpN0MPi4pEN8m1sXLw/g=";
};
buildInputs = [ libusb1 libjpeg8 cups ];
nativeBuildInputs = [ dpkg autoPatchelfHook ];
installPhase = ''
dpkg-deb -x ./Resources/pantum_${version}-1_${architecture}.deb .
mkdir -p $out $out/lib
cp -r etc $out/
cp -r usr/lib/cups $out/lib/
cp -r usr/local/lib/* $out/lib/
cp -r usr/share $out/
cp Resources/locale/en_US.UTF-8/* $out/share/doc/pantum/
'' + lib.optionalString enablePtqpdf ''
cp -r opt/pantum/* $out/
ln -s $out/lib/libqpdf.so* $out/lib/libqpdf.so
ln -s $out/lib/libqpdf.so $out/lib/libqpdf.so.21
'';
meta = {
description = "Pantum universal driver";
homepage = "https://global.pantum.com/";
license = lib.licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -0,0 +1,38 @@
{ lib, stdenv, mkDerivation, fetchzip, autoPatchelfHook, libusb1, libX11, libXtst, qtbase, libglvnd }:
mkDerivation rec {
pname = "pentablet-driver";
version = "1.2.13.1";
src = fetchzip {
url = "https://download01.xp-pen.com/file/2020/04/Linux_Pentablet_V${version}.tar.gz(20200428).zip";
sha256 = "1r423hcpi26v82pzl59br1zw5vablikclqsy6mcqi0v5p84hfrdd";
} + /Linux_Pentablet_V1.2.13.1.tar.gz;
nativeBuildInputs = [
autoPatchelfHook
];
buildInputs = [
libusb1
libX11
libXtst
qtbase
libglvnd
stdenv.cc.cc.lib
];
installPhase = ''
mkdir -p $out/bin
cp Pentablet_Driver $out/bin/pentablet-driver
cp config.xml $out/bin/config.xml
'';
meta = with lib; {
homepage = "https://www.xp-pen.com/download-46.html";
description = "Driver for XP-PEN Pentablet drawing tablets";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ ivar ];
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl, rpmextract }:
let
version = "20160218";
in
stdenv.mkDerivation {
pname = "postscript-lexmark";
inherit version;
src = fetchurl {
url = "https://www.openprinting.org/download/printdriver/components/lsb3.2/main/RPMS/noarch/openprinting-ppds-postscript-lexmark-${version}-1lsb3.2.noarch.rpm";
sha256 = "0wbhvypdr96a5ddg6kj41dn9sbl49n7pfi2vs762ij82hm2gvwcm";
};
nativeBuildInputs = [ rpmextract ];
sourceRoot = ".";
unpackPhase = ''
rpmextract $src
for ppd in opt/OpenPrinting-Lexmark/ppds/Lexmark/*; do
gzip -d $ppd
done
'';
installPhase = ''
mkdir -p $out/share/cups/model/postscript-lexmark
cp opt/OpenPrinting-Lexmark/ppds/Lexmark/*.ppd $out/share/cups/model/postscript-lexmark/
cp -r opt/OpenPrinting-Lexmark/doc $out/doc
'';
meta = with lib; {
homepage = "https://www.openprinting.org/driver/Postscript-Lexmark/";
description = "Lexmark Postscript Drivers";
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,60 @@
{ lib, buildPythonApplication, fetchFromGitHub, wrapGAppsHook
, pytestCheckHook
, gtk3, gobject-introspection, libappindicator-gtk3, librsvg
, evdev, pygobject3, pylibacl, bluez, vdf
, linuxHeaders
, libX11, libXext, libXfixes, libusb1, udev
}:
buildPythonApplication rec {
pname = "sc-controller";
version = "0.4.8.7";
src = fetchFromGitHub {
owner = "Ryochan7";
repo = pname;
rev = "v${version}";
sha256 = "03514sb1spaxdr7x1gq7b54z74in4kd060adj6sq1xjj6d9b297i";
};
# see https://github.com/NixOS/nixpkgs/issues/56943
strictDeps = false;
nativeBuildInputs = [ wrapGAppsHook ];
buildInputs = [ gtk3 gobject-introspection libappindicator-gtk3 librsvg ];
propagatedBuildInputs = [ evdev pygobject3 pylibacl vdf ];
checkInputs = [ pytestCheckHook ];
postPatch = ''
substituteInPlace scc/paths.py --replace sys.prefix "'$out'"
substituteInPlace scc/uinput.py --replace /usr/include ${linuxHeaders}/include
substituteInPlace scc/device_monitor.py --replace "find_library('bluetooth')" "'libbluetooth.so.3'"
'';
LD_LIBRARY_PATH = lib.makeLibraryPath [ libX11 libXext libXfixes libusb1 udev bluez ];
preFixup = ''
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH")
'';
postFixup = ''
(
# scc runs these scripts as programs. (See find_binary() in scc/tools.py.)
cd $out/lib/python*/site-packages/scc/x11
patchPythonScript scc-autoswitch-daemon.py
patchPythonScript scc-osd-daemon.py
)
'';
meta = with lib; {
homepage = "https://github.com/Ryochan7/sc-controller";
# donations: https://www.patreon.com/kozec
description = "User-mode driver and GUI for Steam Controller and other controllers";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ orivej rnhmjoj ];
};
}

View 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");

View 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"

View 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 */

View file

@ -0,0 +1,46 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, libX11, IOKit }:
stdenv.mkDerivation rec {
version = "0.8";
pname = "spacenavd";
src = fetchFromGitHub {
owner = "FreeSpacenav";
repo = "spacenavd";
rev = "v${version}";
sha256 = "1zz0cm5cgvp9s5n4nzksl8rb11c7sw214bdafzra74smvqfjcjcf";
};
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;
configureFlags = [ "--disable-debug" ];
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
meta = with lib; {
homepage = "http://spacenav.sourceforge.net/";
description = "Device driver and SDK for 3Dconnexion 3D input devices";
longDescription = "A free, compatible alternative, to the proprietary 3Dconnexion device driver and SDK, for their 3D input devices (called 'space navigator', 'space pilot', 'space traveller', etc)";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ sohalt ];
};
}

View file

@ -0,0 +1,37 @@
{ lib, fetchFromGitHub, python3Packages, libusb1, linuxHeaders
, GyroplotSupport ? false
}:
with python3Packages;
buildPythonApplication {
pname = "steamcontroller";
version = "2017-08-11";
src = fetchFromGitHub {
owner = "ynsta";
repo = "steamcontroller";
rev = "80928ce237925e0d0d7a65a45b481435ba6b931e";
sha256 = "0lv9j2zv8fmkmc0x9r7fa8zac2xrwfczms35qz1nfa1hr84wniid";
};
postPatch = ''
substituteInPlace src/uinput.py --replace \
"/usr/include" "${linuxHeaders}/include"
'';
buildInputs = [ libusb1 ];
propagatedBuildInputs = [ psutil python3Packages.libusb1 ]
++ lib.optionals GyroplotSupport [ pyqtgraph pyside ];
doCheck = false;
pythonImportsCheck = [ "steamcontroller" ];
meta = with lib; {
description = "A standalone Steam controller driver";
homepage = "https://github.com/ynsta/steamcontroller";
license = licenses.mit;
maintainers = with maintainers; [ rnhmjoj ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,52 @@
{ fetchurl, lib, stdenv }:
with lib;
let
version = "2016-01-26";
rpath = makeLibraryPath [ "$out/lib" "$out/bin" ];
platform = with stdenv;
if isx86_64 then "64bit"
else
if isi686 then "32bit"
else throw "${system} not considered in build derivation. Might still be supported.";
sha256 = with stdenv;
if isx86_64 then "1jfsng5n3phw5rqpkid9m5j7m7zgj5bifh7swvba7f97y6imdaax"
else "15y6r5w306pcq4g1rn9f7vf70f3a7qhq237ngaf0wxh2nr0aamxp";
in
stdenv.mkDerivation {
src = fetchurl {
url = "http://www.sundtek.de/media/netinst/${platform}/installer.tar.gz";
sha256 = sha256;
};
pname = "sundtek";
inherit version;
sourceRoot = ".";
installPhase = ''
cp -r opt $out
# add and fix pkg-config file
mkdir -p $out/lib/pkgconfig
substitute $out/doc/libmedia.pc $out/lib/pkgconfig/libmedia.pc \
--replace /opt $out
'';
postFixup = ''
find $out -type f -exec \
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" {} \
patchelf --set-rpath ${rpath} {} \;
'';
preferLocalBuild = true;
meta = {
description = "Sundtek MediaTV driver";
maintainers = [ maintainers.simonvandel ];
platforms = platforms.unix;
license = licenses.unfree;
homepage = "https://support.sundtek.com/index.php/topic,1573.0.html";
};
}

View file

@ -0,0 +1,174 @@
{ lib, stdenv, writeScriptBin, fetchpatch, fetchFromGitLab, autoreconfHook, pkg-config
, autoconf-archive, libxslt, boost, gtkmm2, imagemagick, sane-backends
, tesseract4, udev, libusb1
, withNetworkScan ? false, utsushi-networkscan
}:
let
fakegit = writeScriptBin "git" ''
#! ${stdenv.shell} -e
if [ "$1" = "describe" ]; then
[ -r .rev ] && cat .rev || true
fi
'';
in stdenv.mkDerivation rec {
pname = "imagescan";
version = "3.65.0";
src = fetchFromGitLab {
owner = "utsushi";
repo = pname;
rev = version;
sha256 = "sha256-CrN9F/WJKmlDN7eozEHtKgGUQBWVwTqwjnrfiATk7lI=";
};
patches = [
(fetchpatch {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-3.63.0-autoconf-2.70.patch?id=4fe8a9e6c60f9163cadad830ba4935c069c67b10";
sha256 = "sha256-2V4cextjcEQrywe4tvvD5KaVYdXnwdNhTiY/aSNx3mM=";
})
(fetchpatch {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-gfx/iscan/files/iscan-3.61.0-imagemagick-7.patch?id=985c92af4730d864e86fa87746185b0246e9db93";
sha256 = "sha256-dfdVMp3ZfclYeRxYjMIvl+ZdlLn9S+IwQ+OmlHW8318=";
})
(fetchpatch {
url = "https://raw.githubusercontent.com/archlinux/svntogit-community/b3046e0e78b95440f135fcadb19a9eb531729a58/trunk/boost-1.74.patch";
sha256 = "sha256-W8R1l7ZPcsfiIy1QBJvh0M8du0w1cnTg3PyAz65v4rE=";
})
];
nativeBuildInputs = [
autoreconfHook
pkg-config
autoconf-archive
fakegit
libxslt
];
buildInputs = [
boost.dev
gtkmm2.dev
imagemagick
sane-backends
udev.dev
libusb1.dev
];
NIX_CFLAGS_COMPILE = [
"-Wno-error=deprecated-declarations"
"-Wno-error=parentheses"
"-Wno-error=unused-variable"
];
postPatch = ''
# create fake udev and sane config
mkdir -p $out/etc/{sane.d,udev/rules.d}
touch $out/etc/sane.d/dll.conf
# absolute paths to convert & tesseract
substituteInPlace filters/magick.cpp \
--replace 'convert ' '${imagemagick}/bin/convert '
substituteInPlace filters/reorient.cpp \
--replace '"tesseract' '"${tesseract4}/bin/tesseract'
substituteInPlace filters/get-text-orientation \
--replace '=tesseract' '=${tesseract4}/bin/tesseract'
'';
configureFlags = [
"--with-boost-libdir=${boost}/lib"
"--with-sane-confdir=${placeholder "out"}/etc/sane.d"
"--with-udev-confdir=${placeholder "out"}/etc/udev"
"--with-gtkmm"
"--with-jpeg"
"--with-magick"
"--with-magick-pp"
"--with-sane"
"--with-tiff"
];
installFlags = [ "SANE_BACKENDDIR=${placeholder "out"}/lib/sane" ];
enableParallelBuilding = true;
doInstallCheck = false;
postInstall = lib.optionalString withNetworkScan ''
ln -s ${utsushi-networkscan}/libexec/utsushi/networkscan $out/libexec/utsushi
'';
meta = with lib; {
description = "SANE utsushi backend for some Epson scanners";
longDescription = ''
ImageScanV3 (aka utsushi) scanner driver. Non-free plugins are not
included, so no network support. To use the SANE backend, in
<literal>/etc/nixos/configuration.nix</literal>:
<literal>
hardware.sane = {
enable = true;
extraBackends = [ pkgs.utsushi ];
};
services.udev.packages = [ pkgs.utsushi ];
</literal>
Supported hardware:
DS-1610, DS-1630, DS-1660W, DS-310, DS-320, DS-360W, DS-40, DS-410,
DS-50000, DS-510, DS-520, DS-530, DS-535, DS-535H, DS-5500, DS-560,
DS-570W, DS-575W, DS-60000, DS-6500, DS-70, DS-70000, DS-7500, DS-760,
DS-770, DS-775, DS-780N, DS-80W, DS-860, EC-4020 Series, EC-4030 Series,
EC-4040 Series, EP-10VA Series, EP-30VA Series, EP-708A Series, EP-709A
Series, EP-710A Series, EP-711A Series, EP-712A Series, EP-808A Series,
EP-810A Series, EP-811A Series, EP-812A Series, EP-879A Series, EP-880A
Series, EP-881A Series, EP-882A Series, EP-978A3 Series, EP-979A3 Series,
EP-982A3 Series, EP-M570T Series, ES-200, ES-300W, ES-300WR, ES-400,
ES-50, ES-50, ES-500W, ES-500WR, ES-55R, ES-60W, ES-60WB, ES-60WW,
ES-65WR, ET-16500 Series, ET-2500 Series, ET-2550 Series, ET-2600 Series,
ET-2610 Series, ET-2650 Series, ET-2700 Series, ET-2710 Series, ET-2720
Series, ET-2750 Series, ET-2760 Series, ET-3600 Series, ET-3700 Series,
ET-3710 Series, ET-3750 Series, ET-3760 Series, ET-4500 Series, ET-4550
Series, ET-4700 Series, ET-4750 Series, ET-4760 Series, ET-7700 Series,
ET-7750 Series, ET-8700 Series, ET-M2140 Series, ET-M2170 Series,
ET-M3140 Series, ET-M3170 Series, ET-M3180 Series, EW-052A Series,
EW-452A Series, EW-M5071FT Series, EW-M571T Series, EW-M630T Series,
EW-M660FT Series, EW-M670FT Series, EW-M770T Series, EW-M970A3T Series,
FF-640, FF-680W, GT-S650, L1455 Series, L220 Series, L222 Series, L3050
Series, L3060 Series, L3070 Series, L3100 Series, L3110 Series, L3150
Series, L3160 Series, L360 Series, L362 Series, L364 Series, L365 Series,
L366 Series, L375 Series, L380 Series, L382 Series, L385 Series, L386
Series, L395 Series, L396 Series, L405 Series, L4150 Series, L4160
Series, L455 Series, L475 Series, L485 Series, L486 Series, L495 Series,
L5190 Series, L565 Series, L566 Series, L575 Series, L605 Series, L6160
Series, L6170 Series, L6190 Series, L655 Series, L7160 Series, L7180
Series, LX-10000F, LX-10000FK, LX-10010MF, LX-7000F, M2140 Series, M2170
Series, M3140 Series, M3170 Series, M3180 Series, PX-048A Series, PX-049A
Series, PX-M160T Series, PX-M270FT Series, PX-M270T Series, PX-M380F,
PX-M381FL, PX-M5080F Series, PX-M5081F Series, PX-M680F Series, PX-M7050
Series, PX-M7050FP, PX-M7050FX, PX-M7070FX, PX-M7110F, PX-M7110FP,
PX-M780F Series, PX-M781F Series, PX-M840FX, PX-M860F, PX-M880FX,
PX-M884F, PX-M885F, PX-M886FL, Perfection V19, Perfection V39, ST-2000
Series, ST-3000 Series, ST-4000 Series, ST-M3000 Series, WF-2750 Series,
WF-2760 Series, WF-2810 Series, WF-2830 Series, WF-2850 Series, WF-2860
Series, WF-3720 Series, WF-3730 Series, WF-4720 Series, WF-4730 Series,
WF-4740 Series, WF-6530 Series, WF-6590 Series, WF-7710 Series, WF-7720
Series, WF-8510 Series, WF-8590 Series, WF-C17590 Series, WF-C20590
Series, WF-C5710 Series, WF-C5790 Series, WF-C5790BA, WF-C579R Series,
WF-C579RB, WF-C8610 Series, WF-C8690 Series, WF-C8690B, WF-C869R Series,
WF-M20590 Series, WF-M5799 Series, WF-R8590 Series, XP-2100 Series,
XP-220 Series, XP-230 Series, XP-235 Series, XP-240 Series, XP-243 245
247 Series, XP-255 257 Series, XP-3100 Series, XP-332 335 Series, XP-340
Series, XP-342 343 345 Series, XP-352 355 Series, XP-4100 Series, XP-430
Series, XP-432 435 Series, XP-440 Series, XP-442 445 Series, XP-452 455
Series, XP-5100 Series, XP-530 Series, XP-540 Series, XP-6000 Series,
XP-6100 Series, XP-630 Series, XP-640 Series, XP-7100 Series, XP-830
Series, XP-8500 Series, XP-8600 Series, XP-900 Series, XP-960 Series,
XP-970 Series
'';
homepage = "https://gitlab.com/utsushi/imagescan";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ wucke13 maxwilson ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, rpmextract }:
stdenv.mkDerivation rec {
pname = "imagescan-plugin-networkscan";
imagescanVersion = "3.65.0";
version = "1.1.4";
src = fetchurl {
url = "https://download2.ebz.epson.net/imagescanv3/fedora/latest1/rpm/x64/imagescan-bundle-fedora-32-${imagescanVersion}.x64.rpm.tar.gz";
sha256 = "sha256-fxi63sV+YJOlv1aVTfCPIXOPfNAo+R7zNPvA11sFmMk=";
};
nativeBuildInputs = [ rpmextract ];
installPhase = ''
rpmextract plugins/imagescan-plugin-networkscan-${version}-*.x86_64.rpm
install -Dm755 usr/libexec/utsushi/networkscan $out/libexec/utsushi/networkscan
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
--set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc ]} \
$out/libexec/utsushi/networkscan
'';
meta = with lib; {
homepage = "https://support.epson.net/linux/en/imagescanv3.php";
description = "Network scan plugin for ImageScan v3";
license = licenses.unfree;
maintainers = with maintainers; [ abbradar ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,44 @@
{ lib
, stdenv
, fetchFromGitHub
, scons
, libX11
, pkg-config
, libusb1
, boost
, glib
, dbus-glib
}:
stdenv.mkDerivation rec {
pname = "xboxdrv";
version = "0.8.8";
src = fetchFromGitHub {
owner = "xboxdrv";
repo = "xboxdrv";
rev = "v${version}";
hash = "sha256-R0Bt4xfzQA1EmZbf7lcWLwSSUayf5Y711QhlAVhiLrY=";
};
makeFlags = [ "PREFIX=$(out)" ];
nativeBuildInputs = [ pkg-config scons ];
buildInputs = [ libX11 libusb1 boost glib dbus-glib ];
enableParallelBuilding = true;
dontUseSconsInstall = true;
patches = [
./fix-60-sec-delay.patch
./scons-py3.patch
./scons-v4.2.0.patch
./xboxdrvctl-py3.patch
];
meta = with lib; {
homepage = "https://xboxdrv.gitlab.io/";
description = "Xbox/Xbox360 (and more) gamepad driver for Linux that works in userspace";
license = licenses.gpl3Plus;
maintainers = [ ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,27 @@
From 7326421eeaadbc2aeb3828628c2e65bb7be323a9 Mon Sep 17 00:00:00 2001
From: buxit <buti@bux.at>
Date: Wed, 2 Nov 2016 16:25:14 +0100
Subject: [PATCH] fix 60 seconds delay
use `libusb_handle_events_timeout_completed()` instead of `libusb_handle_events()`
should fix #144
---
src/usb_gsource.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/usb_gsource.cpp b/src/usb_gsource.cpp
index 00bf1315..afb38f65 100644
--- a/src/usb_gsource.cpp
+++ b/src/usb_gsource.cpp
@@ -174,7 +174,10 @@ USBGSource::on_source_dispatch(GSource* source, GSourceFunc callback, gpointer u
gboolean
USBGSource::on_source()
{
- libusb_handle_events(NULL);
+ struct timeval to;
+ to.tv_sec = 0;
+ to.tv_usec = 0;
+ libusb_handle_events_timeout_completed(NULL, &to, NULL);
return TRUE;
}

View file

@ -0,0 +1,63 @@
From 17bd43a7d3ef86216abc36b42b4e6a1f70aa9979 Mon Sep 17 00:00:00 2001
From: xnick <xnick@users.noreply.github.com>
Date: Thu, 12 Oct 2017 20:34:35 +0300
Subject: [PATCH] Update SConstruct
python3 compatible
---
SConstruct | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/SConstruct b/SConstruct
index 4cd79704..c0007054 100644
--- a/SConstruct
+++ b/SConstruct
@@ -19,7 +19,7 @@ def build_dbus_glue(target, source, env):
xml = re.sub(r"callback = \(([A-Za-z_]+)\) \(marshal_data \? marshal_data : cc->callback\);",
r"union { \1 fn; void* obj; } conv;\n "
"conv.obj = (marshal_data ? marshal_data : cc->callback);\n "
- "callback = conv.fn;", xml)
+ "callback = conv.fn;", xml.decode('utf-8'))
with open(target[0].get_path(), "w") as f:
f.write(xml)
@@ -29,10 +29,10 @@ def build_bin2h(target, source, env):
Takes a list of files and converts them into a C source that can be included
"""
def c_escape(str):
- return str.translate(string.maketrans("/.-", "___"))
+ return str.translate(bytes.maketrans(b"/.-", b"___"))
- print target
- print source
+ print(target)
+ print(source)
with open(target[0].get_path(), "w") as fout:
fout.write("// autogenerated by scons Bin2H builder, do not edit by hand!\n\n")
@@ -45,8 +45,8 @@ def build_bin2h(target, source, env):
data = fin.read()
fout.write("// \"%s\"\n" % src.get_path())
fout.write("const char %s[] = {" % c_escape(src.get_path()))
- bytes_arr = ["0x%02x" % ord(c) for c in data]
- for i in xrange(len(bytes_arr)):
+ bytes_arr = ["0x%02x" % c for c in data]
+ for i in range(len(bytes_arr)):
if i % 13 == 0:
fout.write("\n ")
fout.write(bytes_arr[i])
@@ -131,12 +131,12 @@ env.Append(CPPDEFINES = { 'PACKAGE_VERSION': "'\"%s\"'" % package_version })
conf = Configure(env)
if not conf.env['CXX']:
- print "g++ must be installed!"
+ print('g++ must be installed!')
Exit(1)
# X11 checks
if not conf.CheckLibWithHeader('X11', 'X11/Xlib.h', 'C++'):
- print 'libx11-dev must be installed!'
+ print('libx11-dev must be installed!')
Exit(1)
env = conf.Finish()

View file

@ -0,0 +1,20 @@
--- a/SConstruct 2021-10-31 20:42:44.232084185 -0400
+++ b/SConstruct 2021-10-31 20:42:54.063024444 -0400
@@ -36,7 +36,7 @@
with open(target[0].get_path(), "w") as fout:
fout.write("// autogenerated by scons Bin2H builder, do not edit by hand!\n\n")
- if env.has_key("BIN2H_NAMESPACE"):
+ if "BIN2H_NAMESPACE" in env:
fout.write("namespace %s {\n\n" % env["BIN2H_NAMESPACE"])
# write down data
@@ -62,7 +62,7 @@
for src in source], ",\n"))
fout.write("\n}\n\n")
- if env.has_key("BIN2H_NAMESPACE"):
+ if "BIN2H_NAMESPACE" in env:
fout.write("} // namespace %s\n\n" % env["BIN2H_NAMESPACE"])
fout.write("/* EOF */\n")

View file

@ -0,0 +1,73 @@
--- a/xboxdrvctl 2021-06-21 19:39:51.000000000 -0400
+++ b/xboxdrvctl 19:43:27.467984928 -0400
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
## Xbox360 USB Gamepad Userspace Driver
## Copyright (C) 2011 Ingo Ruhnke <grumbel@gmail.com>
@@ -37,23 +37,23 @@
help="print controller status")
group.add_option("-s", "--slot", metavar="SLOT", type="int",
- dest="slot",
+ dest="slot",
help="use slot SLOT for actions")
group.add_option("-l", "--led", metavar="NUM", type="int",
- dest="led",
+ dest="led",
help="set LED")
-group.add_option("-r", "--rumble", metavar="L:R",
- dest="rumble",
+group.add_option("-r", "--rumble", metavar="L:R",
+ dest="rumble",
help="print controller status")
group.add_option("-c", "--config", metavar="NUM", type="int",
- dest="config",
+ dest="config",
help="switches to controller configuration NUM")
group.add_option("--shutdown", action="store_true",
- dest="shutdown",
+ dest="shutdown",
help="shuts down the daemon")
parser.add_option_group(group)
@@ -69,9 +69,9 @@
try:
bus.get_object("org.seul.Xboxdrv", '/org/seul/Xboxdrv/Daemon')
except dbus.exceptions.DBusException:
- bus = dbus.SystemBus()
+ bus = dbus.SystemBus()
else:
- print "Error: invalid argument to --bus. Must be 'auto', 'session, or 'system'"
+ print("Error: invalid argument to --bus. Must be 'auto', 'session, or 'system'")
exit()
if options.status:
@@ -82,19 +82,19 @@
daemon.Shutdown()
else:
if (options.led or options.rumble or options.config) and options.slot == None:
- print "Error: --slot argument required"
+ print("Error: --slot argument required")
exit()
else:
if options.slot != None:
slot = bus.get_object("org.seul.Xboxdrv", '/org/seul/Xboxdrv/ControllerSlots/%d' % options.slot)
-
+
if options.led != None:
slot.SetLed(options.led)
if options.rumble:
m = re.match('^(\d+):(\d+)$', options.rumble)
if not m:
- print "Error: invalid argument to --rumble"
+ print("Error: invalid argument to --rumble")
exit()
else:
left = int(m.group(1))

View file

@ -0,0 +1,45 @@
{ lib, stdenv, cabextract, fetchurl, fetchFromGitHub, libusb1 }:
stdenv.mkDerivation rec {
pname = "xow";
version = "unstable-2022-04-24";
src = fetchFromGitHub {
owner = "medusalix";
repo = "xow";
rev = "d335d6024f8380f52767a7de67727d9b2f867871";
sha256 = "0q5nr21p4dlx2a99hiivwz6qj9anrqqsdhiz6xi375yqkxis4251";
};
firmware = fetchurl {
url = "http://download.windowsupdate.com/c/msdownload/update/driver/drvs/2017/07/1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e.cab";
sha256 = "013g1zngxffavqrk5jy934q3bdhsv6z05ilfixdn8dj0zy26lwv5";
};
makeFlags = [
"BUILD=RELEASE"
"VERSION=${version}-${src.rev}"
"BINDIR=${placeholder "out"}/bin"
"UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
"MODLDIR=${placeholder "out"}/lib/modules-load.d"
"MODPDIR=${placeholder "out"}/lib/modprobe.d"
"SYSDDIR=${placeholder "out"}/lib/systemd/system"
];
postUnpack = ''
cabextract -F FW_ACC_00U.bin ${firmware}
mv FW_ACC_00U.bin source/firmware.bin
'';
enableParallelBuilding = true;
nativeBuildInputs = [ cabextract ];
buildInputs = [ libusb1 ];
meta = with lib; {
homepage = "https://github.com/medusalix/xow";
description = "Linux driver for the Xbox One wireless dongle";
license = licenses.gpl2Plus;
maintainers = [ maintainers.jansol ];
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,28 @@
{ lib, stdenv, udev, ncurses, pkg-config, fetchurl, bluez }:
stdenv.mkDerivation rec {
pname = "xwiimote";
version = "2";
src = fetchurl {
url = "https://github.com/dvdhrm/xwiimote/releases/download/xwiimote-${version}/xwiimote-${version}.tar.xz";
sha256 = "1g9cbhblll47l300zr999xr51x2g98y49l222f77fhswd12kjzhd";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ udev ncurses bluez ];
configureFlags = [ "--with-doxygen=no" ];
meta = {
homepage = "http://dvdhrm.github.io/xwiimote";
description = "Userspace utilities to control connected Nintendo Wii Remotes";
platforms = lib.platforms.linux;
license = lib.licenses.mit;
};
postInstallPhase = ''
mkdir -p "$out/etc/X11/xorg.conf.d/"
cp "res/50-xorg-fix-xwiimote.conf" "$out/etc/X11/xorg.conf.d/50-fix-xwiimote.conf"
'';
}