Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchzip,
6 wrapGAppsHook3,
7 cairo,
8 copyDesktopItems,
9 dbus,
10 fontconfig,
11 freetype,
12 glib,
13 gtk3,
14 libX11,
15 libXcursor,
16 libXext,
17 libXi,
18 libXrandr,
19 libXrender,
20 libxkbcommon,
21 libgit2,
22 libglvnd,
23 libuuid,
24 libxcb,
25 makeDesktopItem,
26 harfbuzz,
27 libsoup_3,
28 webkitgtk_4_1,
29 zenity,
30}:
31let
32 gkIcon = fetchurl {
33 url = "https://gist.githubusercontent.com/qbit/cb52e6cd193c410e0b0aee8a216f6574/raw/2b042bde1dc4cbd30457f14c9d18c889444bf3d0/glamoroustoolkit.svg";
34 sha256 = "sha256-Trfo8P01anLq9yTFzwqIfsyidLGyuZDg48YQPrGBkgs=";
35 };
36in
37stdenv.mkDerivation (finalAttrs: {
38 pname = "glamoroustoolkit";
39 version = "1.1.32";
40
41 src = fetchzip {
42 url = "https://github.com/feenkcom/gtoolkit-vm/releases/download/v${finalAttrs.version}/GlamorousToolkit-x86_64-unknown-linux-gnu.zip";
43 stripRoot = false;
44 hash = "sha256-uZrq4RM50NcQPHFFfqIRBJ/rq/I09D8WxKz3/xqpOEI=";
45 };
46
47 nativeBuildInputs = [
48 wrapGAppsHook3
49 copyDesktopItems
50 ];
51
52 sourceRoot = ".";
53
54 dontConfigure = true;
55 dontBuild = true;
56 dontPatchELF = true;
57 dontStrip = true;
58
59 desktopItems = with finalAttrs; [
60 (makeDesktopItem {
61 name = pname;
62 desktopName = "GlamorousToolkit";
63 exec = "GlamorousToolkit";
64 icon = "GlamorousToolkit";
65 })
66 ];
67
68 installPhase = ''
69 runHook preInstall
70
71 install -d $out/bin $out/lib $out/share/icons/hicolor/scalable/apps
72
73 cp ${gkIcon} $out/share/icons/hicolor/scalable/apps/GlamorousToolkit.svg
74 cp -r $src/bin $src/lib $out/
75 cp ${./GlamorousToolkit-GetImage} $out/bin/GlamorousToolkit-GetImage
76
77 runHook postInstall
78 '';
79
80 preFixup =
81 let
82 libPath = lib.makeLibraryPath [
83 cairo
84 dbus
85 fontconfig
86 freetype
87 glib
88 gtk3
89 libX11
90 libXcursor
91 libXext
92 libXi
93 libXrandr
94 libXrender
95 libxkbcommon
96 libglvnd
97 libuuid
98 libxcb
99 harfbuzz # libWebView.so
100 libsoup_3 # libWebView.so
101 webkitgtk_4_1 # libWebView.so
102 (lib.getLib stdenv.cc.cc)
103 ];
104 binPath = lib.makeBinPath [
105 zenity # File selection dialog
106 ];
107 in
108 ''
109 chmod +x $out/lib/*.so
110 patchelf \
111 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
112 --set-rpath "${libPath}:$out/lib" \
113 $out/bin/GlamorousToolkit $out/bin/GlamorousToolkit-cli
114 patchelf --shrink-rpath \
115 $out/bin/GlamorousToolkit $out/bin/GlamorousToolkit-cli
116 patchelf \
117 --set-rpath "${libPath}:$out/lib" \
118 $out/lib/*.so
119 patchelf --shrink-rpath $out/lib/*.so
120 #
121 # shrink-rpath gets it wrong for the following libraries,
122 # restore the full rpath.
123 #
124 patchelf \
125 --set-rpath "${libPath}:$out/lib" \
126 $out/lib/libPharoVMCore.so \
127 $out/lib/libWinit.so \
128 $out/lib/libWinit30.so \
129 $out/lib/libPixels.so
130 patchelf --set-rpath $out/lib $out/lib/libssl.so
131
132 ln -s $out/lib/libcrypto.so $out/lib/libcrypto.so.1.1
133 ln -s $out/lib/libcairo.so $out/lib/libcairo.so.2
134 rm $out/lib/libgit2.so
135 ln -s "${libgit2}/lib/libgit2.so" $out/lib/libgit2.so.1.1
136
137 gappsWrapperArgs+=(
138 --prefix PATH : ${binPath}
139 )
140 '';
141
142 meta = {
143 homepage = "https://gtoolkit.com";
144 description = "GlamorousToolkit Development Environment";
145 license = lib.licenses.mit;
146 maintainers = [ lib.maintainers.akgrant43 ];
147 platforms = [ "x86_64-linux" ];
148 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
149 };
150})