depot/third_party/nixpkgs/pkgs/development/web/postman/darwin.nix
Default email 02cf88bb76 Project import generated by Copybara.
GitOrigin-RevId: c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d
2022-08-12 15:06:08 +03:00

49 lines
1.1 KiB
Nix

{ stdenvNoCC
, fetchurl
, unzip
, pname
, version
, meta
}:
let
appName = "Postman.app";
dist = {
aarch64-darwin = {
arch = "arm64";
sha256 = "62b4b3c63668fa4074b35afe08c212557437ff54c742a500087c74955cec9e04";
};
x86_64-darwin = {
arch = "64";
sha256 = "42160a3c3011f43692fcb28b37dec5f708395318681de960f0cb932cea36021f";
};
}.${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
'';
}