nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 autoPatchelfHook,
4 cups,
5 dbus,
6 fontconfig,
7 gccForLibs,
8 libX11,
9 libXcomposite,
10 libXcursor,
11 libXdamage,
12 libXext,
13 libXi,
14 libXrandr,
15 libXrender,
16 libXtst,
17 libinput,
18 libxcb,
19 libxkbcommon,
20 nss,
21 qtbase,
22 qtmultimedia,
23 qtsvg,
24 qttools,
25 qtwebengine,
26 qtwebview,
27 xcbutilimage,
28 xcbutilkeysyms,
29 xcbutilrenderutil,
30 xcbutilwm,
31}:
32
33{
34 pname,
35 version,
36 src,
37 meta,
38}:
39let
40 unwrapped = stdenv.mkDerivation {
41 pname = "${pname}-unwrapped";
42 inherit version src meta;
43
44 nativeBuildInputs = [ autoPatchelfHook ];
45 buildInputs = [
46 cups
47 dbus
48 fontconfig
49 gccForLibs
50 libX11
51 libXcomposite
52 libXcursor
53 libXdamage
54 libXext
55 libXi
56 libXrandr
57 libXrender
58 libXtst
59 libinput
60 libxcb
61 libxkbcommon
62 nss
63 qtbase
64 qtmultimedia
65 qtsvg
66 qttools
67 qtwebengine
68 qtwebview
69 xcbutilimage
70 xcbutilkeysyms
71 xcbutilrenderutil
72 xcbutilwm
73 ];
74
75 dontBuild = true;
76
77 # Don't wrap the Qt apps; upstream has its own wrapper scripts.
78 dontWrapQtApps = true;
79
80 postPatch = ''
81 rm -r lib/plugins lib/libQt6* lib/libssl* lib/libicu* lib/libcrypto*
82 '';
83
84 installPhase = ''
85 mkdir -p $out
86 cp -r bin lib $out
87 addAutoPatchelfSearchPath $out/lib
88 ln -s "${qtbase}/${qtbase.qtPluginPrefix}" $out/lib/plugins
89 '';
90
91 preFixup = ''
92 patchelf --clear-symbol-version close $out/bin/p4{v,admin}.bin
93 '';
94 };
95in
96stdenv.mkDerivation {
97 inherit pname version;
98
99 # Build a "clean" version of the package so that we don't add extra ".bin" or
100 # configuration files to users' PATHs. We can't easily put the unwrapped
101 # package files in libexec (where they belong, probably) because the upstream
102 # wrapper scripts have the bin directory hardcoded.
103 buildCommand = ''
104 mkdir -p $out/bin
105 for f in p4admin p4merge p4v p4vc; do
106 ln -s ${unwrapped}/bin/$f $out/bin
107 done
108 '';
109 preferLocalBuild = true;
110
111 inherit (unwrapped) meta passthru;
112}