1{ lib, stdenv, makeWrapper, fetchurl, dpkg, alsa-lib, atk, cairo, cups, dbus, expat
2, fontconfig, freetype, gdk-pixbuf, glib, pango, mesa, nspr, nss, gtk3
3, at-spi2-atk, gsettings-desktop-schemas, gobject-introspection, wrapGAppsHook
4, libX11, libXScrnSaver, libXcomposite, libXcursor, libXdamage, libXext
5, libXfixes, libXi, libXrandr, libXrender, libXtst, libxcb, libxshmfence, nghttp2
6, libudev0-shim, glibc, curl, openssl, autoPatchelfHook }:
7
8let
9 runtimeLibs = lib.makeLibraryPath [
10 curl
11 glibc
12 libudev0-shim
13 nghttp2
14 openssl
15 stdenv.cc.cc.lib
16 ];
17in stdenv.mkDerivation rec {
18 pname = "insomnia";
19 version = "2023.5.8";
20
21 src = fetchurl {
22 url = "https://github.com/Kong/insomnia/releases/download/core%40${version}/Insomnia.Core-${version}.deb";
23 sha256 = "sha256-x5DYS3DteYtq1EQuJ3EFV/d/YThPgnhhIj+GpEJsFDY=";
24 };
25
26 nativeBuildInputs = [
27 autoPatchelfHook
28 dpkg
29 makeWrapper
30 gobject-introspection
31 wrapGAppsHook
32 ];
33
34 buildInputs = [
35 alsa-lib
36 at-spi2-atk
37 atk
38 cairo
39 cups
40 dbus
41 expat
42 fontconfig
43 freetype
44 gdk-pixbuf
45 glib
46 pango
47 gtk3
48 gsettings-desktop-schemas
49 libX11
50 libXScrnSaver
51 libXcomposite
52 libXcursor
53 libXdamage
54 libXext
55 libXfixes
56 libXi
57 libXrandr
58 libXrender
59 libXtst
60 libxcb
61 libxshmfence
62 mesa # for libgbm
63 nspr
64 nss
65 ];
66
67 dontBuild = true;
68 dontConfigure = true;
69 dontWrapGApps = true;
70
71 unpackPhase = "dpkg-deb -x $src .";
72
73 installPhase = ''
74 mkdir -p $out/share/insomnia $out/lib $out/bin
75
76 mv usr/share/* $out/share/
77 mv opt/Insomnia/* $out/share/insomnia
78
79 ln -s $out/share/insomnia/insomnia $out/bin/insomnia
80 sed -i 's|\/opt\/Insomnia|'$out'/bin|g' $out/share/applications/insomnia.desktop
81 '';
82
83 preFixup = ''
84 wrapProgramShell "$out/bin/insomnia" \
85 "''${gappsWrapperArgs[@]}" \
86 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" \
87 --prefix LD_LIBRARY_PATH : ${runtimeLibs}
88 '';
89
90 meta = with lib; {
91 homepage = "https://insomnia.rest/";
92 description = "The most intuitive cross-platform REST API Client";
93 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
94 license = licenses.mit;
95 platforms = [ "x86_64-linux" ];
96 maintainers = with maintainers; [ markus1189 babariviere kashw2 ];
97 };
98
99}