1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ 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 " <key>SYSTEM_VERSION_COMPAT</key>
<string>0</string>" " <key>SYSTEM_VERSION_COMPAT</key>
<string>0</string>
<key>MOZ_LEGACY_PROFILES</key>
<string>1</string>"
'';
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;
# };
}