1{
2 lib,
3 stdenv,
4 copyDesktopItems,
5 makeWrapper,
6 alsa-lib,
7 at-spi2-atk,
8 at-spi2-core,
9 atk,
10 cairo,
11 cups,
12 curlWithGnuTls,
13 dbus,
14 expat,
15 fontconfig,
16 freetype,
17 gdk-pixbuf,
18 glib,
19 gtk3,
20 libX11,
21 libXcomposite,
22 libXcursor,
23 libXdamage,
24 libXext,
25 libXfixes,
26 libXi,
27 libXrandr,
28 libXrender,
29 libXScrnSaver,
30 libXtst,
31 libdrm,
32 libgbm,
33 libGL,
34 libsecret,
35 libuuid,
36 libxkbcommon,
37 nspr,
38 nss,
39 pango,
40 udev,
41 xorg,
42 bintools,
43 makeDesktopItem,
44 # It's unknown which version of openssl that postman expects but it seems that
45 # OpenSSL 3+ seems to work fine (cf.
46 # https://github.com/NixOS/nixpkgs/issues/254325). If postman breaks apparently
47 # around OpenSSL stuff then try changing this dependency version.
48 openssl,
49 pname,
50 version,
51 src,
52 meta,
53}:
54
55stdenv.mkDerivation {
56 inherit
57 pname
58 version
59 src
60 meta
61 ;
62
63 nativeBuildInputs = [
64 copyDesktopItems
65 makeWrapper
66 ];
67
68 desktopItems = [
69 (makeDesktopItem {
70 name = "postman";
71 exec = "postman %U";
72 icon = "postman";
73 comment = "API Development Environment";
74 desktopName = "Postman";
75 genericName = "Postman";
76 categories = [ "Development" ];
77 })
78 ];
79
80 installPhase = ''
81 runHook preInstall
82
83 mkdir -p $out/share $out/bin
84 cp --recursive app $out/share/postman
85 rm $out/share/postman/Postman
86 makeWrapper $out/share/postman/postman $out/bin/postman \
87 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \
88 --prefix PATH : ${lib.makeBinPath [ openssl ]}
89 mkdir -p $out/share/icons/hicolor/128x128/apps
90 ln -s $out/share/postman/resources/app/assets/icon.png $out/share/icons/postman.png
91 ln -s $out/share/postman/resources/app/assets/icon.png $out/share/icons/hicolor/128x128/apps/postman.png
92
93 runHook postInstall
94 '';
95
96 postFixup = ''
97 patchelf --set-interpreter ${bintools.dynamicLinker} --add-needed libGL.so.1 $out/share/postman/postman
98 patchelf --set-interpreter ${bintools.dynamicLinker} $out/share/postman/chrome_crashpad_handler
99 for file in $(find $out/share/postman -type f \( -name \*.node -o -name postman -o -name \*.so\* \) ); do
100 patchelf --add-rpath "${
101 lib.makeLibraryPath [
102 (lib.getLib stdenv.cc.cc)
103 alsa-lib
104 atk
105 at-spi2-atk
106 at-spi2-core
107 cairo
108 cups
109 curlWithGnuTls
110 dbus
111 expat
112 fontconfig
113 freetype
114 gdk-pixbuf
115 glib
116 gtk3
117 libdrm
118 libgbm
119 libGL
120 libsecret
121 libuuid
122 libX11
123 libXcomposite
124 libXcursor
125 libXdamage
126 libXext
127 libXfixes
128 libXi
129 libXrandr
130 libXrender
131 libXScrnSaver
132 libxkbcommon
133 libXtst
134 nspr
135 nss
136 pango
137 udev
138 xorg.libxcb
139 xorg.libxshmfence
140 ]
141 }" $file
142 done
143 '';
144}