2018-02-23 04:11:30 +00:00
|
|
|
{ lib, stdenv, fetchurl, config, wrapGAppsHook
|
2014-06-23 14:03:11 +01:00
|
|
|
, alsaLib
|
|
|
|
, atk
|
|
|
|
, cairo
|
2016-09-15 16:39:08 +01:00
|
|
|
, curl
|
2014-06-23 14:03:11 +01:00
|
|
|
, cups
|
2018-02-25 02:23:58 +00:00
|
|
|
, dbus-glib
|
2018-07-17 21:11:16 +01:00
|
|
|
, dbus
|
2014-06-23 14:03:11 +01:00
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, gconf
|
2019-05-22 12:03:39 +01:00
|
|
|
, gdk-pixbuf
|
2014-06-23 14:03:11 +01:00
|
|
|
, glib
|
|
|
|
, glibc
|
2016-05-04 01:29:45 +01:00
|
|
|
, gtk2
|
|
|
|
, gtk3
|
2017-09-27 14:30:29 +01:00
|
|
|
, kerberos
|
2014-06-23 14:03:11 +01:00
|
|
|
, libX11
|
|
|
|
, libXScrnSaver
|
2016-08-15 00:03:19 +01:00
|
|
|
, libxcb
|
2014-10-12 14:57:43 +01:00
|
|
|
, libXcomposite
|
2018-07-12 14:05:52 +01:00
|
|
|
, libXcursor
|
2014-10-12 14:57:43 +01:00
|
|
|
, libXdamage
|
2014-06-23 14:03:11 +01:00
|
|
|
, libXext
|
2014-10-12 14:57:43 +01:00
|
|
|
, libXfixes
|
2018-07-12 14:05:52 +01:00
|
|
|
, libXi
|
2014-06-23 14:03:11 +01:00
|
|
|
, libXinerama
|
|
|
|
, libXrender
|
|
|
|
, libXt
|
2018-02-25 02:23:58 +00:00
|
|
|
, libcanberra-gtk2
|
2014-06-23 14:03:11 +01:00
|
|
|
, libgnome
|
|
|
|
, libgnomeui
|
2018-05-07 00:17:16 +01:00
|
|
|
, libnotify
|
2019-02-13 21:47:50 +00:00
|
|
|
, gnome3
|
2019-11-10 16:44:34 +00:00
|
|
|
, libGLU, libGL
|
2014-06-23 14:03:11 +01:00
|
|
|
, nspr
|
|
|
|
, nss
|
|
|
|
, pango
|
2015-06-27 01:22:58 +01:00
|
|
|
, libheimdal
|
2015-05-27 20:42:15 +01:00
|
|
|
, libpulseaudio
|
2014-06-23 14:03:11 +01:00
|
|
|
, systemd
|
2017-06-08 14:33:24 +01:00
|
|
|
, channel
|
|
|
|
, generated
|
2016-12-01 17:58:16 +00:00
|
|
|
, writeScript
|
2018-09-25 19:12:33 +01:00
|
|
|
, writeText
|
2016-12-01 17:58:16 +00:00
|
|
|
, xidel
|
|
|
|
, coreutils
|
|
|
|
, gnused
|
|
|
|
, gnugrep
|
2017-02-19 18:33:31 +00:00
|
|
|
, gnupg
|
2018-06-08 19:29:10 +01:00
|
|
|
, ffmpeg
|
2019-02-28 06:42:31 +00:00
|
|
|
, runtimeShell
|
2019-03-24 08:32:01 +00:00
|
|
|
, systemLocale ? config.i18n.defaultLocale or "en-US"
|
2014-06-23 14:03:11 +01:00
|
|
|
}:
|
|
|
|
|
2014-10-12 14:57:43 +01:00
|
|
|
let
|
2016-05-15 01:59:07 +01:00
|
|
|
|
|
|
|
inherit (generated) version sources;
|
|
|
|
|
2017-11-05 16:09:41 +00:00
|
|
|
mozillaPlatforms = {
|
2019-08-13 22:52:01 +01:00
|
|
|
i686-linux = "linux-i686";
|
|
|
|
x86_64-linux = "linux-x86_64";
|
2017-11-05 16:09:41 +00:00
|
|
|
};
|
|
|
|
|
2018-08-20 20:11:29 +01:00
|
|
|
arch = mozillaPlatforms.${stdenv.hostPlatform.system};
|
2014-06-23 14:03:11 +01:00
|
|
|
|
|
|
|
isPrefixOf = prefix: string:
|
|
|
|
builtins.substring 0 (builtins.stringLength prefix) string == prefix;
|
|
|
|
|
|
|
|
sourceMatches = locale: source:
|
|
|
|
(isPrefixOf source.locale locale) && source.arch == arch;
|
|
|
|
|
2018-09-25 19:12:33 +01:00
|
|
|
policies = {
|
|
|
|
DisableAppUpdate = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
policiesJson = writeText "no-update-firefox-policy.json" (builtins.toJSON { inherit policies; });
|
|
|
|
|
2014-06-23 14:03:11 +01:00
|
|
|
defaultSource = stdenv.lib.findFirst (sourceMatches "en-US") {} sources;
|
|
|
|
|
|
|
|
source = stdenv.lib.findFirst (sourceMatches systemLocale) defaultSource sources;
|
|
|
|
|
2017-06-08 14:33:24 +01:00
|
|
|
name = "firefox-${channel}-bin-unwrapped-${version}";
|
2016-12-01 17:58:16 +00:00
|
|
|
|
2014-06-23 14:03:11 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2016-12-01 17:58:16 +00:00
|
|
|
inherit name;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2016-07-16 12:04:04 +01:00
|
|
|
src = fetchurl { inherit (source) url sha512; };
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2018-09-25 15:36:21 +01:00
|
|
|
phases = [ "unpackPhase" "patchPhase" "installPhase" "fixupPhase" ];
|
2014-06-23 14:03:11 +01:00
|
|
|
|
|
|
|
libPath = stdenv.lib.makeLibraryPath
|
2015-01-15 04:25:26 +00:00
|
|
|
[ stdenv.cc.cc
|
2014-06-23 14:03:11 +01:00
|
|
|
alsaLib
|
2018-02-23 04:11:30 +00:00
|
|
|
(lib.getDev alsaLib)
|
2014-06-23 14:03:11 +01:00
|
|
|
atk
|
|
|
|
cairo
|
2016-09-15 16:39:08 +01:00
|
|
|
curl
|
2014-06-23 14:03:11 +01:00
|
|
|
cups
|
2018-02-25 02:23:58 +00:00
|
|
|
dbus-glib
|
2018-07-17 21:11:16 +01:00
|
|
|
dbus
|
2014-06-23 14:03:11 +01:00
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
gconf
|
2019-05-22 12:03:39 +01:00
|
|
|
gdk-pixbuf
|
2014-06-23 14:03:11 +01:00
|
|
|
glib
|
|
|
|
glibc
|
2016-05-04 01:29:45 +01:00
|
|
|
gtk2
|
|
|
|
gtk3
|
2017-09-27 14:30:29 +01:00
|
|
|
kerberos
|
2014-06-23 14:03:11 +01:00
|
|
|
libX11
|
|
|
|
libXScrnSaver
|
2014-10-12 14:57:43 +01:00
|
|
|
libXcomposite
|
2018-07-12 14:05:52 +01:00
|
|
|
libXcursor
|
2016-08-15 00:03:19 +01:00
|
|
|
libxcb
|
2014-10-12 14:57:43 +01:00
|
|
|
libXdamage
|
2014-06-23 14:03:11 +01:00
|
|
|
libXext
|
2014-10-12 14:57:43 +01:00
|
|
|
libXfixes
|
2018-07-12 14:05:52 +01:00
|
|
|
libXi
|
2014-06-23 14:03:11 +01:00
|
|
|
libXinerama
|
|
|
|
libXrender
|
|
|
|
libXt
|
2018-02-25 02:23:58 +00:00
|
|
|
libcanberra-gtk2
|
2014-06-23 14:03:11 +01:00
|
|
|
libgnome
|
|
|
|
libgnomeui
|
2018-05-07 00:17:16 +01:00
|
|
|
libnotify
|
2019-11-10 16:44:34 +00:00
|
|
|
libGLU libGL
|
2014-06-23 14:03:11 +01:00
|
|
|
nspr
|
|
|
|
nss
|
|
|
|
pango
|
2015-06-27 01:22:58 +01:00
|
|
|
libheimdal
|
2016-08-03 18:39:46 +01:00
|
|
|
libpulseaudio
|
2018-02-23 04:11:30 +00:00
|
|
|
(lib.getDev libpulseaudio)
|
2014-06-23 14:03:11 +01:00
|
|
|
systemd
|
2018-06-08 19:29:10 +01:00
|
|
|
ffmpeg
|
2016-04-14 16:14:28 +01:00
|
|
|
] + ":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" [
|
2015-01-15 04:25:26 +00:00
|
|
|
stdenv.cc.cc
|
2014-06-23 14:03:11 +01:00
|
|
|
];
|
|
|
|
|
2017-06-08 14:33:24 +01:00
|
|
|
inherit gtk3;
|
|
|
|
|
2019-02-13 21:47:50 +00:00
|
|
|
buildInputs = [ wrapGAppsHook gtk3 gnome3.adwaita-icon-theme ];
|
2016-05-04 01:29:45 +01:00
|
|
|
|
2014-06-23 14:03:11 +01:00
|
|
|
# "strip" after "patchelf" may break binaries.
|
|
|
|
# See: https://github.com/NixOS/patchelf/issues/10
|
2017-04-23 14:34:24 +01:00
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2017-06-08 14:33:24 +01:00
|
|
|
patchPhase = ''
|
2018-09-25 15:36:21 +01:00
|
|
|
# Don't download updates from Mozilla directly
|
|
|
|
echo 'pref("app.update.auto", "false");' >> defaults/pref/channel-prefs.js
|
2017-06-08 14:33:24 +01:00
|
|
|
'';
|
|
|
|
|
2014-06-23 14:03:11 +01:00
|
|
|
installPhase =
|
|
|
|
''
|
|
|
|
mkdir -p "$prefix/usr/lib/firefox-bin-${version}"
|
|
|
|
cp -r * "$prefix/usr/lib/firefox-bin-${version}"
|
|
|
|
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
ln -s "$prefix/usr/lib/firefox-bin-${version}/firefox" "$out/bin/"
|
|
|
|
|
|
|
|
for executable in \
|
2015-02-25 13:35:36 +00:00
|
|
|
firefox firefox-bin plugin-container \
|
2014-06-23 14:03:11 +01:00
|
|
|
updater crashreporter webapprt-stub
|
|
|
|
do
|
2016-05-15 01:59:07 +01:00
|
|
|
if [ -e "$out/usr/lib/firefox-bin-${version}/$executable" ]; then
|
|
|
|
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
"$out/usr/lib/firefox-bin-${version}/$executable"
|
|
|
|
fi
|
2014-06-23 14:03:11 +01:00
|
|
|
done
|
|
|
|
|
2015-08-18 12:35:10 +01:00
|
|
|
find . -executable -type f -exec \
|
2014-06-23 14:03:11 +01:00
|
|
|
patchelf --set-rpath "$libPath" \
|
2015-08-18 12:35:10 +01:00
|
|
|
"$out/usr/lib/firefox-bin-${version}/{}" \;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2016-05-08 09:06:08 +01:00
|
|
|
# wrapFirefox expects "$out/lib" instead of "$out/usr/lib"
|
|
|
|
ln -s "$out/usr/lib" "$out/lib"
|
|
|
|
|
2017-04-23 14:34:24 +01:00
|
|
|
gappsWrapperArgs+=(--argv0 "$out/bin/.firefox-wrapped")
|
2018-09-25 19:12:33 +01:00
|
|
|
|
|
|
|
# See: https://github.com/mozilla/policy-templates/blob/master/README.md
|
|
|
|
mkdir -p "$out/lib/firefox-bin-${version}/distribution";
|
|
|
|
ln -s ${policiesJson} "$out/lib/firefox-bin-${version}/distribution/policies.json";
|
2014-06-23 14:03:11 +01:00
|
|
|
'';
|
|
|
|
|
2018-08-09 02:14:59 +01:00
|
|
|
passthru.execdir = "/bin";
|
2016-05-18 22:07:49 +01:00
|
|
|
passthru.ffmpegSupport = true;
|
2017-09-27 14:30:29 +01:00
|
|
|
passthru.gssSupport = true;
|
2018-04-16 11:37:31 +01:00
|
|
|
# update with:
|
|
|
|
# $ nix-shell maintainers/scripts/update.nix --argstr package firefox-bin-unwrapped
|
2016-12-16 15:34:25 +00:00
|
|
|
passthru.updateScript = import ./update.nix {
|
2019-06-18 12:08:32 +01:00
|
|
|
inherit name channel writeScript xidel coreutils gnused gnugrep gnupg curl runtimeShell;
|
2017-06-15 19:28:02 +01:00
|
|
|
baseUrl =
|
|
|
|
if channel == "devedition"
|
|
|
|
then "http://archive.mozilla.org/pub/devedition/releases/"
|
|
|
|
else "http://archive.mozilla.org/pub/firefox/releases/";
|
2016-12-16 15:34:25 +00:00
|
|
|
};
|
2014-06-23 14:03:11 +01:00
|
|
|
meta = with stdenv.lib; {
|
2014-11-25 15:28:55 +00:00
|
|
|
description = "Mozilla Firefox, free web browser (binary package)";
|
2014-06-23 14:03:11 +01:00
|
|
|
homepage = http://www.mozilla.org/firefox/;
|
|
|
|
license = {
|
2014-11-25 15:28:55 +00:00
|
|
|
free = false;
|
2014-06-23 14:03:11 +01:00
|
|
|
url = http://www.mozilla.org/en-US/foundation/trademarks/policy/;
|
|
|
|
};
|
2017-11-05 16:09:41 +00:00
|
|
|
platforms = builtins.attrNames mozillaPlatforms;
|
2019-08-30 12:11:21 +01:00
|
|
|
maintainers = with maintainers; [ taku0 ];
|
2014-06-23 14:03:11 +01:00
|
|
|
};
|
|
|
|
}
|