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