Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

64 lines
1.4 KiB
Nix

{
stdenvNoCC,
fetchurl,
unzip,
runtimeShell,
pname,
version,
meta,
}:
let
appName = "MongoDB Compass.app";
dist =
{
aarch64-darwin = {
arch = "arm64";
sha256 = "sha256-naSOCYxdDLt/zDtR4MhTE96gJypfbk98CWKx2i8kiTk=";
};
x86_64-darwin = {
arch = "x64";
sha256 = "sha256-TnoXaiSNYiblgJS5nygTHOe9HBgVCTfffX37wrwtxZ8=";
};
}
.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
in
stdenvNoCC.mkDerivation {
inherit pname version meta;
src = fetchurl {
url = "https://downloads.mongodb.com/compass/mongodb-compass-${version}-darwin-${dist.arch}.zip";
inherit (dist) sha256;
name = "${pname}-${version}.zip";
};
nativeBuildInputs = [ unzip ];
# The archive will be automatically unzipped; tell Nix where the source root is.
dontFixup = true;
sourceRoot = appName;
installPhase = ''
runHook preInstall
# Create directories for the application bundle and the launcher script.
mkdir -p "$out/Applications/${appName}" "$out/bin"
# Copy the unzipped app bundle into the Applications folder.
cp -R . "$out/Applications/${appName}"
# Create a launcher script that opens the app.
cat > "$out/bin/${pname}" << EOF
#!${runtimeShell}
open -na "$out/Applications/${appName}" --args "\$@"
EOF
chmod +x "$out/bin/${pname}"
runHook postInstall
'';
}