nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 fetchurl,
5 _7zz,
6}:
7let
8 inherit (stdenvNoCC.hostPlatform) system;
9 version = "2.0.5-19905";
10 sourceData = {
11 aarch64-darwin = {
12 arch = "arm64";
13 hash = "sha256-YBiJVRzf3H/u4Ui3/bBID6C6XA2wvo8cBH/IQIhqdXE=";
14 };
15 x86_64-darwin = {
16 arch = "amd64";
17 hash = "sha256-qFj6Lc0m9/dc1/mcJO0aafRZs5vyCQyCb5l+zJwdF+s=";
18 };
19 };
20 sources = lib.mapAttrs (
21 system:
22 { arch, hash }:
23 fetchurl {
24 url = "https://cdn-updates.orbstack.dev/${arch}/OrbStack_v${
25 lib.replaceString "-" "_" version
26 }_${arch}.dmg";
27 inherit hash;
28 }
29 ) sourceData;
30in
31stdenvNoCC.mkDerivation (finalAttrs: {
32 pname = "orbstack";
33 inherit version;
34
35 src = finalAttrs.passthru.sources.${system} or (throw "unsupported system ${system}");
36
37 # -snld prevents "ERROR: Dangerous symbolic link path was ignored"
38 # -xr'!*:com.apple.*' prevents macOS extended attributes (e.g. macl or
39 # quarantine) being turned into real files when extracting an APFS .dmg
40 # (e.g. Info.plist:com.apple.macl or Info.plist:com.apple.quarantine).
41 # These bogus files corrupt the .app bundle and prevent it from launching.
42 unpackCmd = "7zz x -snld -xr'!*:com.apple.*' $curSrc";
43
44 nativeBuildInputs = [ _7zz ];
45
46 sourceRoot = ".";
47
48 installPhase = ''
49 runHook preInstall
50
51 mkdir -p "$out/Applications"
52 cp -R OrbStack.app "$out/Applications"
53
54 mkdir -p "$out/bin"
55 for binary in "$out"/Applications/OrbStack.app/Contents/MacOS/{bin,xbin}/*; do
56 ln -s "$binary" "$out/bin/$(basename "$binary")"
57 done
58
59 runHook postInstall
60 '';
61
62 passthru = {
63 inherit sources;
64 updateScript = ./update.sh;
65 };
66
67 meta = {
68 changelog = "https://docs.orbstack.dev/release-notes#${
69 builtins.replaceStrings [ "." ] [ "-" ] version
70 }";
71 description = "Fast, light, and easy way to run Docker containers and Linux machines";
72 homepage = "https://orbstack.dev/";
73 license = lib.licenses.unfree;
74 mainProgram = "orb";
75 maintainers = with lib.maintainers; [ deejayem ];
76 platforms = lib.platforms.darwin;
77 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
78 };
79})