{ stdenv, fetchurl, undmg, runCommand, ... }: let codesign = runCommand "codesign-build-symlinks" {} '' mkdir -p $out/bin ln -s /usr/bin/codesign $out/bin ''; FirefoxIcon = fetchurl { name = "Firefox.icns"; url = "https://media.macosicons.com/parse/files/macOSicons/3e2e434eb31e1d096e4fe6d87857ad0b_Firefox.icns"; sha256 = "1gl3vvyzm6rdqi6rw2zkr87xh9yphixa9h1swmn81wi60n33qxfi"; }; in stdenv.mkDerivation rec { pname = "Firefox"; version = "101.0"; buildInputs = [ undmg ]; nativeBuildInputs = [ codesign ]; sourceRoot = "."; phases = [ "unpackPhase" "patchPhase" "installPhase" ]; patchPhase = '' substituteInPlace ./Firefox.app/Contents/Info.plist --replace " SYSTEM_VERSION_COMPAT 0" " SYSTEM_VERSION_COMPAT 0 MOZ_LEGACY_PROFILES 1" ''; installPhase = '' mkdir -p "$out/Applications" cp -r Firefox.app "$out/Applications/Firefox.app" cp -r ${FirefoxIcon} "$out/Applications/Firefox.app/Contents/Resources/firefox.icns" codesign --remove-signature "$out/Applications/Firefox.app" ''; src = fetchurl { name = "Firefox-${version}.dmg"; url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-US/Firefox%20${version}.dmg"; sha256 = "1w35ph0kmv7mvm2cg693h56cfpc89gba226acjcblbr94ji7m03y"; }; # meta = with stdenv.lib; { # description = "The Firefox web browser"; # homepage = "https://www.mozilla.org/en-US/firefox"; # platforms = platforms.darwin; # }; }