let
version = "71.0";
in
self: super: {
firefox = with super; stdenv.mkDerivation rec {
inherit version;
name = "firefox-${version}";
buildInputs = [ undmg unzip ];
sourceRoot = ".";
phases = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p "$out/Applications"
cp -r Firefox.app "$out/Applications/firefox.app"
mkdir -p "$out/bin"
cp -r "$out/Applications/firefox.app/Contents/MacOS/firefox" \
"$out/bin/firefox"
'';
src = fetchurl {
name = "firefox-${version}.dmg";
url = "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${version}/mac/en-GB/Firefox%20${version}.dmg";
sha256 = "1kknqpsymh9jyvabhvg47bjgbazji7kpacxdvp9pb97gsv73fym8";
};
meta = with stdenv.lib; {
description = "The Firefox web browser";
homepage = https://www.mozilla.org/en-GB/firefox;
maintainers = with maintainers; [ cmacrae ];
platforms = platforms.darwin;
};
};
}
The package builds and installs correctly using the following:
nixpkgs.overlays = [ (import ../overlays/firefox.nix) ];
programs.firefox.package = pkgs.firefox; # <- home-manager stuff
However, the resulting 'Applications/firefox.app' output differs from other darwin applications:
π ~ ❯ ls -ld .nix-profile/Applications/*
lrwxr-xr-x 1 root wheel 86 1 Jan 1970 .nix-profile/Applications/Alacritty.app -> /nix/store/f7ynz7hdkg824yf8dd37mcwh3wzagn7j-alacritty-0.4.0/Applications/Alacritty.app
lrwxr-xr-x 1 root wheel 91 1 Jan 1970 .nix-profile/Applications/Emacs.app -> /nix/store/kj6g84msvvq1ij3s1j3wf25fwpw6jkl2-emacs-with-packages-26.3/Applications/Emacs.app
dr-xr-xr-x 3 root wheel 96 1 Jan 1970 .nix-profile/Applications/firefox.app
lrwxr-xr-x 1 root wheel 75 1 Jan 1970 .nix-profile/Applications/mpv.app -> /nix/store/qwdg60mda4bgw4nxf6yykllnrsyscb8n-mpv-0.30.0/Applications/mpv.app
As you can see... it's not a symlink.
When digging down into the contents, it seems that the files have the wrong permissions. For instance, the firefox
binary isn't executable:
π ~ ❯ ls -l $(readlink .nix-profile/Applications/firefox.app/Contents/MacOS/firefox)
-r--r--r-- 1 root wheel 36688 1 Jan 1970 /nix/store/cl8ajnznkldr8n20k01h25irrgfjzl7g-firefox-71.0/Applications/firefox.app/Contents/MacOS/firefox