nixpkgs/pkgs/misc/drivers/foo2zjs/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

65 lines
2.0 KiB
Nix

{ lib, stdenv, fetchurl, foomatic-filters, bc, unzip, ghostscript, systemd, vim, time }:
stdenv.mkDerivation rec {
name = "foo2zjs-20180519";
src = fetchurl {
url = "http://www.loegria.net/mirrors/foo2zjs/${name}.tar.gz";
sha256 = "1rmw4jmxn2lqp124mapvnic0ma8ipyvisx2vj848mvad5g5w9x3z";
};
buildInputs = [ foomatic-filters bc unzip ghostscript systemd vim ];
patches = [ ./no-hardcode-fw.diff ];
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;
};
}