postman: add darwin packages (#164697)
This commit is contained in:
parent
aebaef4c01
commit
43b5a5ec59
3 changed files with 192 additions and 99 deletions
49
pkgs/development/web/postman/darwin.nix
Normal file
49
pkgs/development/web/postman/darwin.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ stdenvNoCC
|
||||
, fetchurl
|
||||
, unzip
|
||||
, pname
|
||||
, version
|
||||
, meta
|
||||
}:
|
||||
|
||||
let
|
||||
appName = "Postman.app";
|
||||
dist = {
|
||||
aarch64-darwin = {
|
||||
arch = "arm64";
|
||||
sha256 = "sha256-EtTf17LS18zC3JMbSoyZGGHuIcwGN3Q15XOhVqeh7C4=";
|
||||
};
|
||||
|
||||
x86_64-darwin = {
|
||||
arch = "64";
|
||||
sha256 = "sha256-kTgbqGPgOn5dyjL/IMl3hg2+VUfB+jpPJsqXof8UL+c=";
|
||||
};
|
||||
}.${stdenvNoCC.hostPlatform.system} or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
|
||||
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
inherit pname version meta;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dl.pstmn.io/download/version/${version}/osx_${dist.arch}";
|
||||
inherit (dist) sha256;
|
||||
name = "${pname}-${version}.zip";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
sourceRoot = appName;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/{Applications/${appName},bin}
|
||||
cp -R . $out/Applications/${appName}
|
||||
cat > $out/bin/${pname} << EOF
|
||||
#!${stdenvNoCC.shell}
|
||||
open -na $out/Applications/${appName} --args "$@"
|
||||
EOF
|
||||
chmod +x $out/bin/${pname}
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
|
@ -1,107 +1,18 @@
|
|||
{ lib, stdenv, fetchurl, makeDesktopItem, wrapGAppsHook
|
||||
, atk, at-spi2-atk, at-spi2-core, alsa-lib, cairo, cups, dbus, expat, gdk-pixbuf, glib, gtk3
|
||||
, freetype, fontconfig, nss, nspr, pango, udev, libuuid, libX11, libxcb, libXi
|
||||
, libXcursor, libXdamage, libXrandr, libXcomposite, libXext, libXfixes
|
||||
, libXrender, libXtst, libXScrnSaver, libxkbcommon, libdrm, mesa, xorg
|
||||
}:
|
||||
{ stdenvNoCC, callPackage, lib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
pname = "postman";
|
||||
version = "9.14.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dl.pstmn.io/download/version/${version}/linux64";
|
||||
sha256 = "sha256-pA3gT4xoIWhajY03JzVgHK5KyTx1uH6gyasuLTdt6cM=";
|
||||
name = "${pname}.tar.gz";
|
||||
};
|
||||
|
||||
dontBuild = true; # nothing to build
|
||||
dontConfigure = true;
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = "postman";
|
||||
exec = "postman";
|
||||
icon = "postman";
|
||||
comment = "API Development Environment";
|
||||
desktopName = "Postman";
|
||||
genericName = "Postman";
|
||||
categories = [ "Development" ];
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc.lib
|
||||
atk
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
alsa-lib
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
freetype
|
||||
fontconfig
|
||||
mesa
|
||||
nss
|
||||
nspr
|
||||
pango
|
||||
udev
|
||||
libdrm
|
||||
libuuid
|
||||
libX11
|
||||
libxcb
|
||||
libXi
|
||||
libXcursor
|
||||
libXdamage
|
||||
libXrandr
|
||||
libXcomposite
|
||||
libXext
|
||||
libXfixes
|
||||
libXrender
|
||||
libXtst
|
||||
libXScrnSaver
|
||||
libxkbcommon
|
||||
xorg.libxshmfence
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ wrapGAppsHook ];
|
||||
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/postman
|
||||
cp -R app/* $out/share/postman
|
||||
rm $out/share/postman/Postman
|
||||
|
||||
mkdir -p $out/bin
|
||||
ln -s $out/share/postman/postman $out/bin/postman
|
||||
|
||||
mkdir -p $out/share/applications
|
||||
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
||||
|
||||
iconRootDir=$out/share/icons
|
||||
iconSizeDir=$out/share/icons/hicolor/128x128/apps
|
||||
mkdir -p $iconSizeDir
|
||||
ln -s $out/share/postman/resources/app/assets/icon.png $iconRootDir/postman.png
|
||||
ln -s $out/share/postman/resources/app/assets/icon.png $iconSizeDir/postman.png
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
pushd $out/share/postman
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" postman
|
||||
for file in $(find . -type f \( -name \*.node -o -name postman -o -name \*.so\* \) ); do
|
||||
ORIGIN=$(patchelf --print-rpath $file); \
|
||||
patchelf --set-rpath "${lib.makeLibraryPath buildInputs}:$ORIGIN" $file
|
||||
done
|
||||
popd
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.getpostman.com";
|
||||
description = "API Development Environment";
|
||||
license = licenses.postman;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with maintainers; [ johnrichardrinehart evanjs ];
|
||||
platforms = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
||||
maintainers = with maintainers; [ johnrichardrinehart evanjs tricktron ];
|
||||
};
|
||||
}
|
||||
|
||||
in
|
||||
|
||||
if stdenvNoCC.isDarwin
|
||||
then callPackage ./darwin.nix { inherit pname version meta; }
|
||||
else callPackage ./linux.nix { inherit pname version meta; }
|
||||
|
|
133
pkgs/development/web/postman/linux.nix
Normal file
133
pkgs/development/web/postman/linux.nix
Normal file
|
@ -0,0 +1,133 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, makeDesktopItem
|
||||
, wrapGAppsHook
|
||||
, atk
|
||||
, at-spi2-atk
|
||||
, at-spi2-core
|
||||
, alsa-lib
|
||||
, cairo
|
||||
, cups
|
||||
, dbus
|
||||
, expat
|
||||
, gdk-pixbuf
|
||||
, glib
|
||||
, gtk3
|
||||
, freetype
|
||||
, fontconfig
|
||||
, nss
|
||||
, nspr
|
||||
, pango
|
||||
, udev
|
||||
, libuuid
|
||||
, libX11
|
||||
, libxcb
|
||||
, libXi
|
||||
, libXcursor
|
||||
, libXdamage
|
||||
, libXrandr
|
||||
, libXcomposite
|
||||
, libXext
|
||||
, libXfixes
|
||||
, libXrender
|
||||
, libXtst
|
||||
, libXScrnSaver
|
||||
, libxkbcommon
|
||||
, libdrm
|
||||
, mesa
|
||||
, xorg
|
||||
, pname
|
||||
, version
|
||||
, meta
|
||||
, copyDesktopItems
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
inherit pname version meta;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://dl.pstmn.io/download/version/${version}/linux64";
|
||||
sha256 = "sha256-pA3gT4xoIWhajY03JzVgHK5KyTx1uH6gyasuLTdt6cM=";
|
||||
name = "${pname}.tar.gz";
|
||||
};
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
desktopItems = [
|
||||
(makeDesktopItem {
|
||||
name = "postman";
|
||||
exec = "postman";
|
||||
icon = "postman";
|
||||
comment = "API Development Environment";
|
||||
desktopName = "Postman";
|
||||
genericName = "Postman";
|
||||
categories = [ "Development" ];
|
||||
})
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc.lib
|
||||
atk
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
alsa-lib
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
gdk-pixbuf
|
||||
glib
|
||||
gtk3
|
||||
freetype
|
||||
fontconfig
|
||||
mesa
|
||||
nss
|
||||
nspr
|
||||
pango
|
||||
udev
|
||||
libdrm
|
||||
libuuid
|
||||
libX11
|
||||
libxcb
|
||||
libXi
|
||||
libXcursor
|
||||
libXdamage
|
||||
libXrandr
|
||||
libXcomposite
|
||||
libXext
|
||||
libXfixes
|
||||
libXrender
|
||||
libXtst
|
||||
libXScrnSaver
|
||||
libxkbcommon
|
||||
xorg.libxshmfence
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ wrapGAppsHook copyDesktopItems ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/share/postman
|
||||
cp -R app/* $out/share/postman
|
||||
rm $out/share/postman/Postman
|
||||
|
||||
mkdir -p $out/bin
|
||||
ln -s $out/share/postman/postman $out/bin/postman
|
||||
|
||||
mkdir -p $out/share/icons/hicolor/128x128/apps
|
||||
ln -s $out/share/postman/resources/app/assets/icon.png $out/share/icons/postman.png
|
||||
ln -s $out/share/postman/resources/app/assets/icon.png $out/share/icons/hicolor/128x128/apps/postman.png
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
pushd $out/share/postman
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" postman
|
||||
for file in $(find . -type f \( -name \*.node -o -name postman -o -name \*.so\* \) ); do
|
||||
ORIGIN=$(patchelf --print-rpath $file); \
|
||||
patchelf --set-rpath "${lib.makeLibraryPath buildInputs}:$ORIGIN" $file
|
||||
done
|
||||
popd
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue