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,27 @@
{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, avahi, libjpeg, libpng
, libxml2, gnutls, sane-backends }:
stdenv.mkDerivation rec {
pname = "sane-airscan";
version = "0.99.27";
nativeBuildInputs = [ meson ninja pkg-config ];
buildInputs = [ avahi gnutls libjpeg libpng libxml2 sane-backends ];
src = fetchFromGitHub {
owner = "alexpevzner";
repo = pname;
rev = version;
sha256 = "sha256-29IPoLF4rmq8sGTi5RmpT1Fq8RJJlaepTt+2GWDU3es=";
};
meta = with lib; {
homepage = "https://github.com/alexpevzner/sane-airscan";
description = "Scanner Access Now Easy - Apple AirScan (eSCL) driver";
longDescription = ''
sane-airscan: Linux support of Apple AirScan (eSCL) compatible document scanners.
'';
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ zaninime ];
};
}

View file

@ -0,0 +1,95 @@
{ stdenv, lib, fetchurl, callPackage, patchelf, makeWrapper, libusb-compat-0_1 }:
let
myPatchElf = file: with lib; ''
patchelf --set-interpreter \
${stdenv.cc.libc}/lib/ld-linux${optionalString stdenv.is64bit "-x86-64"}.so.2 \
${file}
'';
udevRules = callPackage ./udev_rules_type1.nix { };
in
stdenv.mkDerivation rec {
pname = "brscan4";
version = "0.4.10-1";
src = {
"i686-linux" = fetchurl {
url = "http://download.brother.com/welcome/dlf006646/${pname}-${version}.i386.deb";
sha256 = "sha256-ymIAg+rfSYP5uzsAM1hUYZacJ0PXmKEoljNtb0pgGMw=";
};
"x86_64-linux" = fetchurl {
url = "https://download.brother.com/welcome/dlf006645/${pname}-${version}.amd64.deb";
sha256 = "sha256-Gpr5456MCNpyam3g2qPo7S3aEZFMaUGR8bu7YmRY8xk=";
};
}."${stdenv.hostPlatform.system}";
unpackPhase = ''
ar x $src
tar xfvz data.tar.gz
'';
nativeBuildInputs = [ makeWrapper patchelf udevRules ];
buildInputs = [ libusb-compat-0_1 ];
dontBuild = true;
postPatch = ''
${myPatchElf "opt/brother/scanner/brscan4/brsaneconfig4"}
RPATH=${libusb-compat-0_1.out}/lib
for a in usr/lib64/sane/*.so*; do
if ! test -L $a; then
patchelf --set-rpath $RPATH $a
fi
done
'';
installPhase = with lib; ''
runHook preInstall
PATH_TO_BRSCAN4="opt/brother/scanner/brscan4"
mkdir -p $out/$PATH_TO_BRSCAN4
cp -rp $PATH_TO_BRSCAN4/* $out/$PATH_TO_BRSCAN4
mkdir -p $out/lib/sane
cp -rp usr/lib${optionalString stdenv.is64bit "64"}/sane/* $out/lib/sane
# Symbolic links were absolute. Fix them so that they point to $out.
pushd "$out/lib/sane" > /dev/null
for a in *.so*; do
if test -L $a; then
fixedTargetFileName="$(basename $(readlink $a))"
unlink "$a"
ln -s -T "$fixedTargetFileName" "$a"
fi
done
popd > /dev/null
# Generate an LD_PRELOAD wrapper to redirect execvp(), open() and open64()
# calls to `/opt/brother/scanner/brscan4`.
preload=$out/libexec/brother/scanner/brscan4/libpreload.so
mkdir -p $(dirname $preload)
gcc -shared ${./preload.c} -o $preload -ldl -DOUT=\"$out\" -fPIC
makeWrapper \
"$out/$PATH_TO_BRSCAN4/brsaneconfig4" \
"$out/bin/brsaneconfig4" \
--set LD_PRELOAD $preload
mkdir -p $out/etc/sane.d
echo "brother4" > $out/etc/sane.d/dll.conf
mkdir -p $out/etc/udev/rules.d
cp -p ${udevRules}/etc/udev/rules.d/*.rules \
$out/etc/udev/rules.d
runHook postInstall
'';
dontStrip = true;
dontPatchELF = true;
meta = {
description = "Brother brscan4 sane backend driver";
homepage = "http://www.brother.com";
platforms = [ "i686-linux" "x86_64-linux" ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ jraygauthier ];
};
}

View file

@ -0,0 +1,170 @@
/* Brgen4 search for configuration under `/etc/opt/brother/scanner/brscan4`. This
LD_PRELOAD library intercepts execvp(), open and open64 calls to redirect them to
the corresponding location in $out. Also support specifying an alternate
file name for `brsanenetdevice4.cfg` which otherwise is invariable
created at `/etc/opt/brother/scanner/brscan4`*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#include <string.h>
#include <dirent.h>
char origDir [] = "/etc/opt/brother/scanner/brscan4";
char realDir [] = OUT "/opt/brother/scanner/brscan4";
char devCfgFileNameEnvVar [] = "BRSANENETDEVICE4_CFG_FILENAME";
char devCfgFileName [] = "/etc/opt/brother/scanner/brscan4//brsanenetdevice4.cfg";
const char * rewrite(const char * path, char * buf)
{
if (strncmp(path, devCfgFileName, sizeof(devCfgFileName)) == 0) {
const char* newCfgFileName = getenv(devCfgFileNameEnvVar);
if (!newCfgFileName) return path;
if (snprintf(buf, PATH_MAX, "%s", newCfgFileName) >= PATH_MAX)
abort();
return buf;
}
if (strncmp(path, origDir, sizeof(origDir) - 1) != 0) return path;
if (snprintf(buf, PATH_MAX, "%s%s", realDir, path + sizeof(origDir) - 1) >= PATH_MAX)
abort();
return buf;
}
const char* findAndReplaceFirstOccurence(const char* inStr, const char* subStr,
const char* replaceStr,
char* buf, unsigned maxBuf)
{
const char* foundStr = strstr(inStr, subStr);
if (!foundStr)
return inStr;
const unsigned inStrLen = strlen(inStr);
const unsigned subStrLen = strlen(subStr);
const unsigned replaceStrLen = strlen(replaceStr);
const unsigned precedingStrLen = foundStr - inStr;
if (precedingStrLen + 1 > maxBuf)
return NULL;
const unsigned followingStrPos = precedingStrLen + subStrLen;
const unsigned followingStrLen = inStrLen - followingStrPos;
strncpy(buf, inStr, precedingStrLen);
unsigned outLength = precedingStrLen;
if (outLength + replaceStrLen + 1 > maxBuf)
return NULL;
strncpy(buf + outLength, replaceStr, replaceStrLen);
outLength += replaceStrLen;
if (outLength + followingStrLen + 1 > maxBuf)
return NULL;
strncpy(buf + outLength, inStr + followingStrPos, followingStrLen);
outLength += followingStrLen;
buf[outLength] = '\0';
return buf;
}
const char* rewriteSystemCall(const char* command, char* buf, unsigned maxBuf)
{
const char* foundStr = strstr(command, devCfgFileName);
if (!foundStr)
return command;
const char* replaceStr = getenv(devCfgFileNameEnvVar);
if (!replaceStr) return command;
const char* result =
findAndReplaceFirstOccurence(command, devCfgFileName, replaceStr, buf, maxBuf);
if (!result)
abort();
return result;
}
int execvp(const char * path, char * const argv[])
{
int (*_execvp) (const char *, char * const argv[]) = dlsym(RTLD_NEXT, "execvp");
char buf[PATH_MAX];
return _execvp(rewrite(path, buf), argv);
}
int open(const char *path, int flags, ...)
{
char buf[PATH_MAX];
int (*_open) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open");
mode_t mode = 0;
if (flags & O_CREAT) {
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
}
return _open(rewrite(path, buf), flags, mode);
}
int open64(const char *path, int flags, ...)
{
char buf[PATH_MAX];
int (*_open64) (const char *, int, mode_t) = dlsym(RTLD_NEXT, "open64");
mode_t mode = 0;
if (flags & O_CREAT) {
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
}
return _open64(rewrite(path, buf), flags, mode);
}
FILE* fopen(const char* path, const char* mode)
{
char buf[PATH_MAX];
FILE* (*_fopen) (const char*, const char*) = dlsym(RTLD_NEXT, "fopen");
return _fopen(rewrite(path, buf), mode);
}
FILE *fopen64(const char *path, const char *mode)
{
char buf[PATH_MAX];
FILE* (*_fopen64) (const char*, const char*) = dlsym(RTLD_NEXT, "fopen64");
return _fopen64(rewrite(path, buf), mode);
}
DIR* opendir(const char* path)
{
char buf[PATH_MAX];
DIR* (*_opendir) (const char*) = dlsym(RTLD_NEXT, "opendir");
return _opendir(rewrite(path, buf));
}
#define SYSTEM_CMD_MAX 512
int system(const char *command)
{
char buf[SYSTEM_CMD_MAX];
int (*_system) (const char*) = dlsym(RTLD_NEXT, "system");
const char* newCommand = rewriteSystemCall(command, buf, SYSTEM_CMD_MAX);
return _system(newCommand);
}

View file

@ -0,0 +1,56 @@
{ lib, stdenv, fetchurl, libsaneUDevRuleNumber ? "49" }:
stdenv.mkDerivation rec {
pname = "brother-udev-rule-type1";
version = "1.0.0-1";
src = fetchurl {
url = "http://download.brother.com/welcome/dlf006654/brother-udev-rule-type1-${version}.all.deb";
sha256 = "0i0x5jw135pli4jl9mgnr5n2rrdvml57nw84yq2999r4frza53xi";
};
dontBuild = true;
unpackPhase = ''
ar x $src
tar xfvz data.tar.gz
'';
/*
Fix the following error:
~~~
invalid rule 49-brother-libsane-type1.rules
unknown key 'SYSFS{idVendor}'
~~~
Apparently the udev rules syntax has change and the SYSFS key has to
be changed to ATTR.
See:
- <http://ubuntuforums.org/showthread.php?t=1496878>
- <http://www.planet-libre.org/index.php?post_id=10937>
*/
patchPhase = ''
sed -i -e s/SYSFS/ATTR/g opt/brother/scanner/udev-rules/type1/*.rules
'';
installPhase = ''
mkdir -p $out/etc/udev/rules.d
cp opt/brother/scanner/udev-rules/type1/NN-brother-mfp-type1.rules \
$out/etc/udev/rules.d/${libsaneUDevRuleNumber}-brother-libsane-type1.rules
chmod 644 $out/etc/udev/rules.d/${libsaneUDevRuleNumber}-brother-libsane-type1.rules
'';
dontStrip = true;
dontPatchELF = true;
meta = {
description = "Brother type1 scanners udev rules";
homepage = "http://www.brother.com";
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ jraygauthier ];
};
}

View file

@ -0,0 +1,108 @@
{ stdenv, lib, fetchurl, callPackage, patchelf, makeWrapper, libusb1, avahi-compat, glib, libredirect, nixosTests }:
let
myPatchElf = file: with lib; ''
patchelf --set-interpreter \
${stdenv.cc.libc}/lib/ld-linux${optionalString stdenv.is64bit "-x86-64"}.so.2 \
${file}
'';
system = stdenv.hostPlatform.system;
in
stdenv.mkDerivation rec {
pname = "brscan5";
version = "1.2.9-0";
src = {
"i686-linux" = fetchurl {
url = "https://download.brother.com/welcome/dlf104034/${pname}-${version}.i386.deb";
sha256 = "ac23c9a435818955e7882ab06380adf346203ff4e45f384b40e84b8b29642f07";
};
"x86_64-linux" = fetchurl {
url = "https://download.brother.com/welcome/dlf104033/${pname}-${version}.amd64.deb";
sha256 = "4ec23ff4b457323ae778e871a0f1abcc1848ea105af17850b57f7dcaddcfd96d";
};
}."${system}" or (throw "Unsupported system: ${system}");
unpackPhase = ''
ar x $src
tar xfv data.tar.xz
'';
nativeBuildInputs = [ makeWrapper patchelf ];
buildInputs = [ libusb1 avahi-compat stdenv.cc.cc glib ];
dontBuild = true;
postPatch =
let
patchOffsetBytes =
if system == "x86_64-linux" then 84632
else if system == "i686-linux" then 77396
else throw "Unsupported system: ${system}";
in
''
${myPatchElf "opt/brother/scanner/brscan5/brsaneconfig5"}
${myPatchElf "opt/brother/scanner/brscan5/brscan_cnetconfig"}
${myPatchElf "opt/brother/scanner/brscan5/brscan_gnetconfig"}
for file in opt/brother/scanner/brscan5/*.so.* opt/brother/scanner/brscan5/brscan_[cg]netconfig; do
if ! test -L $file; then
patchelf --set-rpath ${lib.makeLibraryPath buildInputs} $file
fi
done
# driver is hardcoded to look in /opt/brother/scanner/brscan5/models for model metadata.
# patch it to look in /etc/opt/brother/scanner/models instead, so nixos environment.etc can make it available
printf '/etc/opt/brother/scanner/models\x00' | dd of=opt/brother/scanner/brscan5/libsane-brother5.so.1.0.7 bs=1 seek=${toString patchOffsetBytes} conv=notrunc
'';
installPhase = with lib; ''
runHook preInstall
PATH_TO_BRSCAN5="opt/brother/scanner/brscan5"
mkdir -p $out/$PATH_TO_BRSCAN5
cp -rp $PATH_TO_BRSCAN5/* $out/$PATH_TO_BRSCAN5
pushd $out/$PATH_TO_BRSCAN5
ln -s libLxBsDeviceAccs.so.1.0.0 libLxBsDeviceAccs.so.1
ln -s libLxBsNetDevAccs.so.1.0.0 libLxBsNetDevAccs.so.1
ln -s libLxBsScanCoreApi.so.3.2.0 libLxBsScanCoreApi.so.3
ln -s libLxBsUsbDevAccs.so.1.0.0 libLxBsUsbDevAccs.so.1
ln -s libsane-brother5.so.1.0.7 libsane-brother5.so.1
popd
mkdir -p $out/lib/sane
for file in $out/$PATH_TO_BRSCAN5/*.so.* ; do
ln -s $file $out/lib/sane/
done
makeWrapper \
"$out/$PATH_TO_BRSCAN5/brsaneconfig5" \
"$out/bin/brsaneconfig5" \
--suffix-each NIX_REDIRECT ":" "/etc/opt/brother/scanner/brscan5=$out/opt/brother/scanner/brscan5 /opt/brother/scanner/brscan5=$out/opt/brother/scanner/brscan5" \
--set LD_PRELOAD ${libredirect}/lib/libredirect.so
mkdir -p $out/etc/sane.d/dll.d
echo "brother5" > $out/etc/sane.d/dll.d/brother5.conf
mkdir -p $out/etc/udev/rules.d
cp -p $PATH_TO_BRSCAN5/udev-rules/NN-brother-mfp-brscan5-1.0.2-2.rules \
$out/etc/udev/rules.d/49-brother-mfp-brscan5-1.0.2-2.rules
ETCDIR=$out/etc/opt/brother/scanner/brscan5
mkdir -p $ETCDIR
cp -rp $PATH_TO_BRSCAN5/{models,brscan5.ini,brsanenetdevice.cfg} $ETCDIR/
runHook postInstall
'';
dontPatchELF = true;
passthru.tests = { inherit (nixosTests) brscan5; };
meta = {
description = "Brother brscan5 sane backend driver";
homepage = "https://www.brother.com";
platforms = [ "i686-linux" "x86_64-linux" ];
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ mattchrist ];
};
}

View file

@ -0,0 +1,119 @@
{ stdenv, lib, fetchurl, runtimeShell
, gettext, pkg-config, python3
, avahi, libgphoto2, libieee1284, libjpeg, libpng, libtiff, libusb1, libv4l, net-snmp
, curl, systemd, libxml2, poppler, gawk
, sane-drivers
# List of { src name backend } attibute sets - see installFirmware below:
, extraFirmware ? []
# For backwards compatibility with older setups; use extraFirmware instead:
, gt68xxFirmware ? null, snapscanFirmware ? null
# Not included by default, scan snap drivers require fetching of unfree binaries.
, scanSnapDriversUnfree ? false, scanSnapDriversPackage ? sane-drivers.epjitsu
}:
stdenv.mkDerivation {
pname = "sane-backends";
version = "1.0.32";
src = fetchurl {
# raw checkouts of the repo do not work because, the configure script is
# only functional in manually uploaded release tarballs.
# https://gitlab.com/sane-project/backends/-/issues/440
# unfortunately this make the url unpredictable on update, to find the link
# go to https://gitlab.com/sane-project/backends/-/releases and choose
# the link with other in the URL.
url = "https://gitlab.com/sane-project/backends/uploads/104f09c07d35519cc8e72e604f11643f/sane-backends-1.0.32.tar.gz";
sha256 = "055iicihxa6b28iv5fnz13n67frdr5nrydq2c846f9x7q0vw4a1s";
};
outputs = [ "out" "doc" "man" ];
nativeBuildInputs = [
gettext
pkg-config
python3
];
buildInputs = [
avahi
libgphoto2
libjpeg
libpng
libtiff
libusb1
curl
libxml2
poppler
gawk
] ++ lib.optionals stdenv.isLinux [
libieee1284
libv4l
net-snmp
systemd
];
enableParallelBuilding = true;
configureFlags =
lib.optional (avahi != null) "--with-avahi"
++ lib.optional (libusb1 != null) "--with-usb"
;
postInstall = let
compatFirmware = extraFirmware
++ lib.optional (gt68xxFirmware != null) {
src = gt68xxFirmware.fw;
inherit (gt68xxFirmware) name;
backend = "gt68xx";
}
++ lib.optional (snapscanFirmware != null) {
src = snapscanFirmware;
name = "your-firmwarefile.bin";
backend = "snapscan";
};
installFirmware = f: ''
mkdir -p $out/share/sane/${f.backend}
ln -sv ${f.src} $out/share/sane/${f.backend}/${f.name}
'';
in ''
mkdir -p $out/etc/udev/rules.d/
./tools/sane-desc -m udev > $out/etc/udev/rules.d/49-libsane.rules || \
cp tools/udev/libsane.rules $out/etc/udev/rules.d/49-libsane.rules
# the created 49-libsane references /bin/sh
substituteInPlace $out/etc/udev/rules.d/49-libsane.rules \
--replace "RUN+=\"/bin/sh" "RUN+=\"${runtimeShell}"
substituteInPlace $out/lib/libsane.la \
--replace "-ljpeg" "-L${lib.getLib libjpeg}/lib -ljpeg"
# net.conf conflicts with the file generated by the nixos module
rm $out/etc/sane.d/net.conf
''
+ lib.optionalString scanSnapDriversUnfree ''
# the ScanSnap drivers live under the epjitsu subdirectory, which was already created by the build but is empty.
rmdir $out/share/sane/epjitsu
ln -svT ${scanSnapDriversPackage} $out/share/sane/epjitsu
''
+ lib.concatStrings (builtins.map installFirmware compatFirmware);
meta = with lib; {
description = "SANE (Scanner Access Now Easy) backends";
longDescription = ''
Collection of open-source SANE backends (device drivers).
SANE is a universal scanner interface providing standardized access to
any raster image scanner hardware: flatbed scanners, hand-held scanners,
video- and still-cameras, frame-grabbers, etc. For a list of supported
scanners, see http://www.sane-project.org/sane-backends.html.
'';
homepage = "http://www.sane-project.org/";
license = licenses.gpl2Plus;
platforms = platforms.linux ++ platforms.darwin;
};
}

View file

@ -0,0 +1,53 @@
{ lib, stdenv, fetchurl, rpmextract }:
stdenv.mkDerivation rec {
pname = "libsane-dsseries";
version = "1.0.5-1";
src = fetchurl {
url = "https://download.brother.com/welcome/dlf100974/${pname}-${version}.x86_64.rpm";
sha256 = "1wfdbfbf51cc7njzikdg48kwpnpc0pg5s6p0s0y3z0q7y59x2wbq";
};
nativeBuildInputs = [ rpmextract ];
unpackCmd = ''
mkdir ${pname}-${version} && pushd ${pname}-${version}
rpmextract $curSrc
popd
'';
patchPhase = ''
substituteInPlace etc/udev/rules.d/50-Brother_DSScanner.rules \
--replace 'GROUP="users"' 'GROUP="scanner", ENV{libsane_matched}="yes"'
mkdir -p etc/sane.d/dll.d
echo "dsseries" > etc/sane.d/dll.d/dsseries.conf
'';
installPhase = ''
mkdir -p $out
cp -dr etc $out
cp -dr usr/lib64 $out/lib
'';
preFixup = ''
for f in `find $out/lib/sane/ -type f`; do
# Make it possible to find libstdc++.so.6
patchelf --set-rpath ${stdenv.cc.cc.lib}/lib:$out/lib/sane $f
# Horrible kludge: The driver hardcodes /usr/lib/sane/ as a dlopen path.
# We can directly modify the binary to force a relative lookup instead.
# The new path is NULL-padded to the same length as the original path.
sed -i "s|/usr/lib/sane/%s|%s\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00|g" $f
done
'';
meta = {
description = "Brother DSSeries SANE backend driver";
homepage = "http://www.brother.com";
platforms = lib.platforms.linux;
license = lib.licenses.unfree;
maintainers = with lib.maintainers; [ callahad ];
};
}

View file

@ -0,0 +1,53 @@
{ lib, stdenv }:
{ paths, disabledDefaultBackends ? [] }:
with lib;
let
installSanePath = path: ''
if [ -e "${path}/lib/sane" ]; then
find "${path}/lib/sane" -maxdepth 1 -not -type d | while read backend; do
symlink "$backend" "$out/lib/sane/$(basename "$backend")"
done
fi
if [ -e "${path}/etc/sane.d" ]; then
find "${path}/etc/sane.d" -maxdepth 1 -not -type d | while read conf; do
name="$(basename $conf)"
if [ "$name" = "dll.conf" ] || [ "$name" = "saned.conf" ] || [ "$name" = "net.conf" ]; then
cat "$conf" >> "$out/etc/sane.d/$name"
else
symlink "$conf" "$out/etc/sane.d/$name"
fi
done
fi
if [ -e "${path}/etc/sane.d/dll.d" ]; then
find "${path}/etc/sane.d/dll.d" -maxdepth 1 -not -type d | while read conf; do
symlink "$conf" "$out/etc/sane.d/dll.d/$(basename $conf)"
done
fi
'';
disableBackend = backend: ''
grep -q '${backend}' $out/etc/sane.d/dll.conf || { echo '${backend} is not a default plugin in $SANE_CONFIG_DIR/dll.conf'; exit 1; }
substituteInPlace $out/etc/sane.d/dll.conf --replace '${backend}' '# ${backend} disabled in nixos config'
'';
in
stdenv.mkDerivation {
name = "sane-config";
dontUnpack = true;
installPhase = ''
function symlink () {
local target=$1 linkname=$2
if [ -e "$linkname" ]; then
echo "warning: conflict for $linkname. Overriding $(readlink $linkname) with $target."
fi
ln -sfn "$target" "$linkname"
}
mkdir -p $out/etc/sane.d $out/etc/sane.d/dll.d $out/lib/sane
''
+ (concatMapStrings installSanePath paths)
+ (concatMapStrings disableBackend disabledDefaultBackends);
}

View file

@ -0,0 +1,13 @@
{ lib, fetchFromGitHub }:
{
# Fujitsu ScanSnap
epjitsu = fetchFromGitHub {
name = "scansnap-firmware";
owner = "stevleibelt";
repo = "scansnap-firmware";
rev = "96c3a8b2a4e4f1ccc4e5827c5eb5598084fd17c8";
sha256 = "1inchnvaqyw9d0skpg8hp5rpn27c09q58lsr42by4bahpbx5qday";
meta.license = lib.licenses.unfree;
};
}

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, sane-backends, libX11, gtk2, pkg-config, libusb-compat-0_1 ? null }:
stdenv.mkDerivation rec {
pname = "sane-frontends";
version = "1.0.14";
src = fetchurl {
url = "https://alioth-archive.debian.org/releases/sane/${pname}/${version}/${pname}-${version}.tar.gz";
sha256 = "1ad4zr7rcxpda8yzvfkq1rfjgx9nl6lan5a628wvpdbh3fn9v0z7";
};
preConfigure = ''
sed -e '/SANE_CAP_ALWAYS_SETTABLE/d' -i src/gtkglue.c
'';
buildInputs = [ sane-backends libX11 gtk2 ]
++ lib.optional (libusb-compat-0_1 != null) libusb-compat-0_1;
nativeBuildInputs = [ pkg-config ];
enableParallelBuilding = true;
meta = with lib; {
description = "Scanner Access Now Easy";
homepage = "http://www.sane-project.org/";
license = licenses.gpl2Plus;
platforms = platforms.linux;
};
}

View file

@ -0,0 +1,41 @@
{ lib
, stdenv
, fetchurl
, sane-backends
, sane-frontends
, libX11
, gtk2
, pkg-config
, libpng
, libusb-compat-0_1
, gimpSupport ? false
, gimp
}:
stdenv.mkDerivation rec {
pname = "xsane";
version = "0.999";
src = fetchurl {
url = "http://www.xsane.org/download/xsane-${version}.tar.gz";
sha256 = "0jrb918sfb9jw3vmrz0z7np4q55hgsqqffpixs0ir5nwcwzd50jp";
};
preConfigure = ''
sed -e '/SANE_CAP_ALWAYS_SETTABLE/d' -i src/xsane-back-gtk.c
chmod a+rX -R .
'';
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libpng libusb-compat-0_1 sane-backends sane-frontends libX11 gtk2 ]
++ lib.optional gimpSupport gimp;
meta = with lib; {
homepage = "http://www.sane-project.org/";
description = "Graphical scanning frontend for sane";
license = licenses.gpl2Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ ];
};
}