nixpkgs/pkgs/development/web/postman/darwin.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.3 KiB
Nix
Raw Normal View History

2022-03-30 14:01:39 +00:00
{ stdenvNoCC
, fetchurl
, unzip
, pname
, version
, meta
}:
let
appName = "Postman.app";
dist = {
aarch64-darwin = {
arch = "arm64";
2023-09-24 19:20:39 +00:00
sha256 = "sha256-Dy37gqClpV/9GzlpX6FjF+grDN/txbZO7G5BpEA2sms=";
2022-03-30 14:01:39 +00:00
};
x86_64-darwin = {
arch = "64";
2023-09-24 19:20:39 +00:00
sha256 = "sha256-gYlgrq3IyQtcecv9kuh1bHP1TVTPM8Apx2ZU5JLSSkQ=";
2022-03-30 14:01:39 +00:00
};
}.${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 ];
# Postman is notarized on macOS. Running the fixup phase will change the shell scripts embedded
# in the bundle, which causes the notarization check to fail on macOS 13+.
# See https://eclecticlight.co/2022/06/17/app-security-changes-coming-in-ventura/ for more information.
dontFixup = true;
2022-03-30 14:01:39 +00:00
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
'';
}