tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
cups-brother-mfcl2800dw: init at 4.1.0-1
luftmensch-luftmensch
2 years ago
15560bfc
1cc90fe9
+103
1 changed file
expand all
collapse all
unified
split
pkgs
by-name
cu
cups-brother-mfcl2800dw
package.nix
+103
pkgs/by-name/cu/cups-brother-mfcl2800dw/package.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{
2
+
lib,
3
+
stdenv,
4
+
fetchurl,
5
+
dpkg,
6
+
autoPatchelfHook,
7
+
makeWrapper,
8
+
perl,
9
+
gnused,
10
+
ghostscript,
11
+
file,
12
+
coreutils,
13
+
gnugrep,
14
+
which,
15
+
}:
16
+
let
17
+
arches = [
18
+
"x86_64"
19
+
"i686"
20
+
];
21
+
version = "4.1.0-1";
22
+
23
+
runtimeDeps = [
24
+
ghostscript
25
+
file
26
+
gnused
27
+
gnugrep
28
+
coreutils
29
+
which
30
+
];
31
+
in
32
+
stdenv.mkDerivation {
33
+
pname = "cups-brother-mfcl2800dw";
34
+
inherit version;
35
+
36
+
nativeBuildInputs = [
37
+
dpkg
38
+
makeWrapper
39
+
autoPatchelfHook
40
+
];
41
+
buildInputs = [ perl ];
42
+
43
+
dontUnpack = true;
44
+
45
+
src = fetchurl {
46
+
url = "https://download.brother.com/welcome/dlf106048/mfcl2800dwpdrv-${version}.i386.deb";
47
+
hash = "sha256-sY92w0EFI69LxoNrhluIhqFOWZQOI+SJKKyuExvasgA=";
48
+
};
49
+
50
+
installPhase =
51
+
''
52
+
runHook preInstall
53
+
54
+
mkdir -p $out
55
+
dpkg-deb -x $src $out
56
+
57
+
# delete unnecessary files for the current architecture
58
+
''
59
+
+ lib.concatMapStrings (arch: ''
60
+
echo Deleting files for ${arch}
61
+
rm -r "$out/opt/brother/Printers/MFCL2800DW/lpd/${arch}"
62
+
'') (builtins.filter (arch: arch != stdenv.hostPlatform.linuxArch) arches)
63
+
+ ''
64
+
65
+
# bundled scripts don't understand the arch subdirectories for some reason
66
+
ln -s \
67
+
"$out/opt/brother/Printers/MFCL2800DW/lpd/${stdenv.hostPlatform.linuxArch}/"* \
68
+
"$out/opt/brother/Printers/MFCL2800DW/lpd/"
69
+
70
+
# Fix global references and replace auto discovery mechanism with hardcoded values
71
+
substituteInPlace $out/opt/brother/Printers/MFCL2800DW/lpd/lpdfilter \
72
+
--replace-fail /opt "$out/opt" \
73
+
--replace-fail "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/MFCL2800DW\"; #" \
74
+
--replace-fail "PRINTER =~" "PRINTER = \"MFCL2800DW\"; #"
75
+
76
+
# Make sure all executables have the necessary runtime dependencies available
77
+
find "$out" -executable -and -type f | while read file; do
78
+
wrapProgram "$file" --prefix PATH : "${lib.makeBinPath runtimeDeps}"
79
+
done
80
+
81
+
# Symlink filter and ppd into a location where CUPS will discover it
82
+
mkdir -p $out/lib/cups/filter $out/share/cups/model
83
+
84
+
ln -s \
85
+
$out/opt/brother/Printers/MFCL2800DW/lpd/lpdfilter \
86
+
$out/lib/cups/filter/brother_lpdwrapper_MFCL2800DW
87
+
88
+
ln -s \
89
+
$out/opt/brother/Printers/MFCL2800DW/cupswrapper/brother-MFCL2800DW-cups-en.ppd \
90
+
$out/share/cups/model/
91
+
92
+
runHook postInstall
93
+
'';
94
+
95
+
meta = {
96
+
homepage = "http://www.brother.com/";
97
+
description = "Brother MFC-L2750DW printer driver";
98
+
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
99
+
license = lib.licenses.unfree;
100
+
platforms = builtins.map (arch: "${arch}-linux") arches;
101
+
maintainers = [ lib.maintainers.luftmensch-luftmensch ];
102
+
};
103
+
}