13 url = "https://github.com/Kong/insomnia/releases/download/core%40${version}/Insomnia.Core-${version}.dmg";
14 hash = "sha256-HYEZzLDV2T4ugCjIeskS5SkrQlu5nQt1S0RG9R/rlcs=";
17 url = "https://github.com/Kong/insomnia/releases/download/core%40${version}/Insomnia.Core-${version}.AppImage";
18 hash = "sha256-hElisKB1C1By8lCCgNqNr6bIOMKqMG3UyBQ6jYu8yNg=";
20 }.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
23 homepage = "https://insomnia.rest";
24 description = " The open-source, cross-platform API client for GraphQL, REST, WebSockets, SSE and gRPC. With Cloud, Local and Git storage.";
25 mainProgram = "insomnia";
26 changelog = "https://github.com/Kong/insomnia/releases/tag/core@${version}";
27 license = licenses.asl20;
28 platforms = [ "x86_64-linux" "x86_64-darwin" ];
29 maintainers = with maintainers; [ markus1189 kashw2 DataHearth ];
32 if stdenv.hostPlatform.isDarwin then stdenv.mkDerivation {
33 inherit pname version src meta;
37 echo "Creating temp directory"
38 mnt=$(TMPDIR=/tmp mktemp -d -t nix-XXXXXXXXXX)
40 echo "Ejecting temp directory"
41 /usr/bin/hdiutil detach $mnt -force
44 # Detach volume when receiving SIG "0"
47 echo "Mounting DMG file into \"$mnt\""
48 /usr/bin/hdiutil attach -nobrowse -mountpoint $mnt $curSrc
49 # Copy content to local dir for later use
50 echo 'Copying extracted content into "sourceRoot"'
51 cp -a $mnt/Insomnia.app $PWD/
56 mkdir -p "$out/Applications"
57 mv Insomnia.app $out/Applications/
60 } else appimageTools.wrapType2 {
61 inherit pname version src meta;
63 extraInstallCommands = let
64 appimageContents = appimageTools.extract {
65 inherit pname version src;
68 # Install XDG Desktop file and its icon
69 install -Dm444 ${appimageContents}/insomnia.desktop -t $out/share/applications
70 install -Dm444 ${appimageContents}/insomnia.png -t $out/share/pixmaps
71 # Replace wrong exec statement in XDG Desktop file
72 substituteInPlace $out/share/applications/insomnia.desktop \
73 --replace-fail 'Exec=AppRun --no-sandbox %U' 'Exec=insomnia'