2018-02-23 04:11:30 +00:00
|
|
|
{ lib, stdenv, fetchurl, config, wrapGAppsHook
|
2021-06-10 03:57:09 +01:00
|
|
|
, alsa-lib
|
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
|
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
|
2021-03-14 16:11:48 +00:00
|
|
|
, libkrb5
|
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
|
2020-06-20 22:34:54 +01:00
|
|
|
, libcanberra
|
2018-05-07 00:17:16 +01:00
|
|
|
, libnotify
|
2021-05-07 22:18:14 +01:00
|
|
|
, gnome
|
2019-11-10 16:44:34 +00:00
|
|
|
, libGLU, libGL
|
2014-06-23 14:03:11 +01:00
|
|
|
, nspr
|
|
|
|
, nss
|
|
|
|
, pango
|
2021-05-01 23:59:06 +01:00
|
|
|
, pipewire
|
2021-03-14 06:09:09 +00:00
|
|
|
, pciutils
|
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
|
2020-08-10 21:19:23 +01:00
|
|
|
, ffmpeg
|
2019-02-28 06:42:31 +00:00
|
|
|
, runtimeShell
|
2020-07-10 03:56:06 +01:00
|
|
|
, mesa # firefox wants gbm for drm+dmabuf
|
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; });
|
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
defaultSource = lib.findFirst (sourceMatches "en-US") {} sources;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
source = lib.findFirst (sourceMatches systemLocale) defaultSource sources;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2021-07-12 11:51:53 +01:00
|
|
|
pname = "firefox-${channel}-bin-unwrapped";
|
2016-12-01 17:58:16 +00:00
|
|
|
|
2014-06-23 14:03:11 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-07-12 11:51:53 +01:00
|
|
|
inherit pname version;
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2020-07-14 19:26:15 +01:00
|
|
|
src = fetchurl { inherit (source) url sha256; };
|
2014-06-23 14:03:11 +01:00
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
libPath = lib.makeLibraryPath
|
2015-01-15 04:25:26 +00:00
|
|
|
[ stdenv.cc.cc
|
2021-06-10 03:57:09 +01:00
|
|
|
alsa-lib
|
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
|
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
|
2021-03-14 16:11:48 +00:00
|
|
|
libkrb5
|
2020-07-10 03:56:06 +01:00
|
|
|
mesa
|
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
|
2020-06-20 22:34:54 +01:00
|
|
|
libcanberra
|
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
|
2021-05-01 23:59:06 +01:00
|
|
|
pipewire
|
2021-03-14 06:09:09 +00:00
|
|
|
pciutils
|
2015-06-27 01:22:58 +01:00
|
|
|
libheimdal
|
2016-08-03 18:39:46 +01:00
|
|
|
libpulseaudio
|
2014-06-23 14:03:11 +01:00
|
|
|
systemd
|
2020-08-10 21:19:23 +01:00
|
|
|
ffmpeg
|
2021-01-15 13:21:58 +00:00
|
|
|
] + ":" + 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;
|
|
|
|
|
2021-05-07 22:18:14 +01:00
|
|
|
buildInputs = [ wrapGAppsHook gtk3 gnome.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 {
|
2021-08-09 11:09:43 +01:00
|
|
|
inherit pname 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
|
|
|
};
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-11-25 15:28:55 +00:00
|
|
|
description = "Mozilla Firefox, free web browser (binary package)";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.mozilla.org/firefox/";
|
2014-06-23 14:03:11 +01:00
|
|
|
license = {
|
2014-11-25 15:28:55 +00:00
|
|
|
free = false;
|
2020-04-01 02:11:51 +01:00
|
|
|
url = "http://www.mozilla.org/en-US/foundation/trademarks/policy/";
|
2014-06-23 14:03:11 +01:00
|
|
|
};
|
2017-11-05 16:09:41 +00:00
|
|
|
platforms = builtins.attrNames mozillaPlatforms;
|
2021-02-07 08:06:48 +00:00
|
|
|
maintainers = with maintainers; [ taku0 lovesegfault ];
|
2014-06-23 14:03:11 +01:00
|
|
|
};
|
|
|
|
}
|