1{
2 lib,
3 fetchzip,
4 makeShellWrapper,
5 makeDesktopItem,
6 stdenv,
7 gtk3,
8 libXtst,
9 glib,
10 zlib,
11 wrapGAppsHook3,
12}:
13
14let
15 desktopItem = makeDesktopItem rec {
16 name = "TLA+Toolbox";
17 exec = "tla-toolbox";
18 icon = "tla-toolbox";
19 comment = "IDE for TLA+";
20 desktopName = name;
21 genericName = comment;
22 categories = [ "Development" ];
23 startupWMClass = "TLA+ Toolbox";
24 };
25
26in
27stdenv.mkDerivation rec {
28 pname = "tla-toolbox";
29 version = "1.7.1";
30 src = fetchzip {
31 url = "https://tla.msr-inria.inria.fr/tlatoolbox/products/TLAToolbox-${version}-linux.gtk.x86_64.zip";
32 sha256 = "02a2y2mkfab5cczw8g604m61h4xr0apir49zbd1aq6mmgcgngw80";
33 };
34
35 buildInputs = [ gtk3 ];
36
37 nativeBuildInputs = [
38 makeShellWrapper
39 wrapGAppsHook3
40 ];
41
42 dontWrapGApps = true;
43
44 installPhase = ''
45 runHook preInstall
46
47 mkdir -p "$out/bin"
48 cp -r "$src" "$out/toolbox"
49 chmod -R +w "$out/toolbox"
50
51 fixupPhase
52 gappsWrapperArgsHook
53
54 patchelf \
55 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
56 "$out/toolbox/toolbox"
57
58 patchelf \
59 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
60 --set-rpath "${lib.makeLibraryPath [ zlib ]}:$(patchelf --print-rpath $(find "$out/toolbox" -name java))" \
61 "$(find "$out/toolbox" -name java)"
62
63 patchelf \
64 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
65 "$(find "$out/toolbox" -name jspawnhelper)"
66
67 makeShellWrapper $out/toolbox/toolbox $out/bin/tla-toolbox \
68 --chdir "$out/toolbox" \
69 --add-flags "-data ~/.tla-toolbox" \
70 --prefix LD_LIBRARY_PATH : "${
71 lib.makeLibraryPath [
72 gtk3
73 libXtst
74 glib
75 zlib
76 ]
77 }" \
78 "''${gappsWrapperArgs[@]}"
79
80 echo -e "\nCreating TLA Toolbox icons..."
81 pushd "$src"
82 for icon_in in $(find . -path "./plugins/*/icons/full/etool16/tla_launch_check_wiz_*.png")
83 do
84 icon_size=$(echo $icon_in | grep -Po "wiz_\K[0-9]+")
85 icon_out="$out/share/icons/hicolor/$icon_size""x$icon_size/apps/tla-toolbox.png"
86 mkdir -p "$(dirname $icon_out)"
87 cp "$icon_in" "$icon_out"
88 done
89 popd
90
91 echo -e "\nCreating TLA Toolbox desktop entry..."
92 cp -r "${desktopItem}/share/applications"* "$out/share/applications"
93
94 runHook postInstall
95 '';
96
97 meta = {
98 homepage = "http://research.microsoft.com/en-us/um/people/lamport/tla/toolbox.html";
99 description = "IDE for the TLA+ tools";
100 mainProgram = "tla-toolbox";
101 longDescription = ''
102 Integrated development environment for the TLA+ tools, based on Eclipse. You can use it
103 to create and edit your specs, run the PlusCal translator, view the pretty-printed
104 versions of your modules, run the TLC model checker, and run TLAPS, the TLA+ proof system.
105 '';
106 # http://lamport.azurewebsites.net/tla/license.html
107 license = with lib.licenses; [ mit ];
108 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
109 platforms = [ "x86_64-linux" ];
110 maintainers = [ ];
111 };
112}