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.2.2";
20
21 src = fetchurl {
22 url =
23 "https://github.com/Kong/insomnia/releases/download/core%40${version}/Insomnia.Core-${version}.deb";
24 sha256 = "sha256-XM7OLr5ety95jjlVqNuQp3rD9laoe1uC1HNP66HJe5M=";
25 };
26
27 nativeBuildInputs = [
28 autoPatchelfHook
29 dpkg
30 makeWrapper
31 gobject-introspection
32 wrapGAppsHook
33 ];
34
35 buildInputs = [
36 alsa-lib
37 at-spi2-atk
38 atk
39 cairo
40 cups
41 dbus
42 expat
43 fontconfig
44 freetype
45 gdk-pixbuf
46 glib
47 pango
48 gtk3
49 gsettings-desktop-schemas
50 libX11
51 libXScrnSaver
52 libXcomposite
53 libXcursor
54 libXdamage
55 libXext
56 libXfixes
57 libXi
58 libXrandr
59 libXrender
60 libXtst
61 libxcb
62 libxshmfence
63 mesa # for libgbm
64 nspr
65 nss
66 ];
67
68 dontBuild = true;
69 dontConfigure = true;
70 dontWrapGApps = true;
71
72 unpackPhase = "dpkg-deb -x $src .";
73
74 installPhase = ''
75 mkdir -p $out/share/insomnia $out/lib $out/bin
76
77 mv usr/share/* $out/share/
78 mv opt/Insomnia/* $out/share/insomnia
79
80 ln -s $out/share/insomnia/insomnia $out/bin/insomnia
81 sed -i 's|\/opt\/Insomnia|'$out'/bin|g' $out/share/applications/insomnia.desktop
82 '';
83
84 preFixup = ''
85 wrapProgram "$out/bin/insomnia" "''${gappsWrapperArgs[@]}" --prefix LD_LIBRARY_PATH : ${runtimeLibs}
86 '';
87
88 meta = with lib; {
89 homepage = "https://insomnia.rest/";
90 description = "The most intuitive cross-platform REST API Client";
91 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
92 license = licenses.mit;
93 platforms = [ "x86_64-linux" ];
94 maintainers = with maintainers; [ markus1189 babariviere ];
95 };
96
97}