Skip to content

Instantly share code, notes, and snippets.

@thomashoneyman
Created May 3, 2022 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomashoneyman/8a5317850e91b7255ddf4fa9c4a383d2 to your computer and use it in GitHub Desktop.
Save thomashoneyman/8a5317850e91b7255ddf4fa9c4a383d2 to your computer and use it in GitHub Desktop.
chromium on mac
{ pkgs }:
if pkgs.stdenv.isLinux then
pkgs.chromium
else
let
wrapped = pkgs.writeShellScriptBin "chromium" ''
${chromium-mac}/Chromium.app/Contents/MacOS/Chromium $@
'';
chromium-mac = final.stdenv.mkDerivation rec {
name = "chromium-mac";
pname = "Chromium";
build = "844399";
# To update run:
# nix-prefetch-url --name 'chromium-mac.zip' https://playwright.azureedge.net/builds/chromium/${build}/chromium-mac.zip
src = let
builds = {
"844399" = {
sha256 =
"sha256-KiPsa4qUDAfjzWmm2CGX/HwwYGLDZP8xHX8JeBuNwHk=";
};
};
in final.fetchzip {
url =
"https://playwright.azureedge.net/builds/chromium/${build}/${name}.zip";
sha256 = builds.${build}.sha256;
name = "${name}";
};
# The dmg contains the app and a symlink, the default unpackPhase tries to cd
# into the only directory produced so it fails.
sourceRoot = ".";
installPhase = ''
mkdir $out
mv chromium-mac/Chromium.app $out
'';
meta = with final.lib; { platforms = [ "x86_64-darwin" ]; };
};
in final.symlinkJoin {
name = "chromium-mac";
paths = [ wrapped chromium-mac ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment