2019-02-03 16:31:25 +01:00
|
|
|
{ newScope, config, stdenv, llvmPackages, gcc8Stdenv, llvmPackages_7
|
|
|
|
, makeWrapper, makeDesktopItem, ed
|
2018-02-25 03:23:58 +01:00
|
|
|
, glib, gtk3, gnome3, gsettings-desktop-schemas
|
2019-02-18 09:17:05 +01:00
|
|
|
, libva ? null
|
2012-12-03 17:55:09 +01:00
|
|
|
|
2012-12-03 18:23:49 +01:00
|
|
|
# package customization
|
2012-12-03 17:55:09 +01:00
|
|
|
, channel ? "stable"
|
2012-12-03 18:23:49 +01:00
|
|
|
, enableNaCl ? false
|
2016-09-13 19:42:55 +02:00
|
|
|
, gnomeSupport ? false, gnome ? null
|
2014-03-19 12:21:10 +01:00
|
|
|
, gnomeKeyringSupport ? false
|
2012-12-03 18:23:49 +01:00
|
|
|
, proprietaryCodecs ? true
|
2014-03-19 11:32:39 +01:00
|
|
|
, enablePepperFlash ? false
|
2014-09-30 06:00:47 +02:00
|
|
|
, enableWideVine ? false
|
2019-03-31 01:04:49 +01:00
|
|
|
, useVaapi ? false # test video on radeon, before enabling this
|
2014-12-07 14:52:36 +01:00
|
|
|
, cupsSupport ? true
|
2019-02-03 16:31:25 +01:00
|
|
|
, pulseSupport ? config.pulseaudio or stdenv.isLinux
|
2017-01-05 17:46:37 +01:00
|
|
|
, commandLineArgs ? ""
|
chromium: Minimal build (no install) from source.
This only gets chromium to build so far, installation is missing by upstream, so
we need to manually copy the corresponding files. And I guess with nix, we also
need to patch a few paths on installation.
Another issue is that at the moment, a lot of dependencies are used from the
source tree, rather than from the system.
Also, it would be nice to build using LLVM, as it really speeds up compilation a
*LOT* and also has the side effect of resulting in smaller binaries.
Working unit tests would be nice, too. Unfortunately they're quite heavyweight
and take hours to run, so I guess "someday" would be the most appropriate time
to integrate.
Further todo's:
- Allow to disable GConf, GIO and CUPS.
- Option to disable the sandbox (for whatever reason the user might have).
- Integrate gold binutils.
- Pulseaudio support.
- Clearly separate Linux specific stuff.
2012-06-12 10:19:22 +02:00
|
|
|
}:
|
2009-10-30 09:45:58 +01:00
|
|
|
|
chromium: Minimal build (no install) from source.
This only gets chromium to build so far, installation is missing by upstream, so
we need to manually copy the corresponding files. And I guess with nix, we also
need to patch a few paths on installation.
Another issue is that at the moment, a lot of dependencies are used from the
source tree, rather than from the system.
Also, it would be nice to build using LLVM, as it really speeds up compilation a
*LOT* and also has the side effect of resulting in smaller binaries.
Working unit tests would be nice, too. Unfortunately they're quite heavyweight
and take hours to run, so I guess "someday" would be the most appropriate time
to integrate.
Further todo's:
- Allow to disable GConf, GIO and CUPS.
- Option to disable the sandbox (for whatever reason the user might have).
- Integrate gold binutils.
- Pulseaudio support.
- Clearly separate Linux specific stuff.
2012-06-12 10:19:22 +02:00
|
|
|
let
|
2019-02-03 16:31:25 +01:00
|
|
|
stdenv_ = if stdenv.isAarch64 then gcc8Stdenv else llvmPackages_7.stdenv;
|
|
|
|
llvmPackages_ = if stdenv.isAarch64 then llvmPackages else llvmPackages_7;
|
|
|
|
in let
|
|
|
|
stdenv = stdenv_;
|
|
|
|
llvmPackages = llvmPackages_;
|
|
|
|
|
2014-03-19 12:21:10 +01:00
|
|
|
callPackage = newScope chromium;
|
2014-03-19 11:32:39 +01:00
|
|
|
|
2014-03-19 12:21:10 +01:00
|
|
|
chromium = {
|
2018-10-28 17:07:19 +01:00
|
|
|
inherit stdenv llvmPackages;
|
2018-10-24 23:25:36 +02:00
|
|
|
|
2016-05-04 22:11:50 +02:00
|
|
|
upstream-info = (callPackage ./update.nix {}).getChannel channel;
|
2014-03-19 12:51:39 +01:00
|
|
|
|
2016-10-29 04:05:53 +02:00
|
|
|
mkChromiumDerivation = callPackage ./common.nix {
|
2018-06-19 02:48:42 +02:00
|
|
|
inherit enableNaCl gnomeSupport gnome
|
2016-11-08 20:18:15 +01:00
|
|
|
gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport
|
2019-02-18 09:17:05 +01:00
|
|
|
useVaapi
|
2016-11-08 20:18:15 +01:00
|
|
|
enableWideVine;
|
2014-03-19 12:57:49 +01:00
|
|
|
};
|
|
|
|
|
2016-05-04 17:37:34 +02:00
|
|
|
browser = callPackage ./browser.nix { inherit channel; };
|
2014-03-22 17:05:14 +01:00
|
|
|
|
2014-03-19 12:57:49 +01:00
|
|
|
plugins = callPackage ./plugins.nix {
|
2016-11-01 11:39:34 +01:00
|
|
|
inherit enablePepperFlash enableWideVine;
|
2014-03-19 11:32:39 +01:00
|
|
|
};
|
2018-10-28 17:07:19 +01:00
|
|
|
};
|
2014-03-19 11:32:39 +01:00
|
|
|
|
2014-03-16 13:32:39 +01:00
|
|
|
desktopItem = makeDesktopItem {
|
2017-03-05 15:02:56 +01:00
|
|
|
name = "chromium-browser";
|
2015-08-04 23:35:13 +02:00
|
|
|
exec = "chromium %U";
|
2015-08-14 05:19:38 +02:00
|
|
|
icon = "chromium";
|
2014-03-16 13:32:39 +01:00
|
|
|
comment = "An open source web browser from Google";
|
|
|
|
desktopName = "Chromium";
|
|
|
|
genericName = "Web browser";
|
2014-04-20 07:01:37 +02:00
|
|
|
mimeType = stdenv.lib.concatStringsSep ";" [
|
|
|
|
"text/html"
|
|
|
|
"text/xml"
|
|
|
|
"application/xhtml+xml"
|
|
|
|
"x-scheme-handler/http"
|
|
|
|
"x-scheme-handler/https"
|
|
|
|
"x-scheme-handler/ftp"
|
|
|
|
"x-scheme-handler/mailto"
|
|
|
|
"x-scheme-handler/webcal"
|
2014-11-24 12:10:20 +01:00
|
|
|
"x-scheme-handler/about"
|
|
|
|
"x-scheme-handler/unknown"
|
2014-04-20 07:01:37 +02:00
|
|
|
];
|
2014-03-16 13:32:39 +01:00
|
|
|
categories = "Network;WebBrowser";
|
2016-02-29 20:42:58 +01:00
|
|
|
extraEntries = ''
|
|
|
|
StartupWMClass=chromium-browser
|
|
|
|
'';
|
2014-03-16 13:32:39 +01:00
|
|
|
};
|
|
|
|
|
2014-11-25 10:08:28 +01:00
|
|
|
suffix = if channel != "stable" then "-" + channel else "";
|
|
|
|
|
2016-08-06 10:13:20 +02:00
|
|
|
sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName;
|
|
|
|
|
2017-06-16 07:49:50 +02:00
|
|
|
version = chromium.browser.version;
|
|
|
|
|
2014-03-22 17:05:14 +01:00
|
|
|
in stdenv.mkDerivation {
|
2017-06-16 07:49:50 +02:00
|
|
|
name = "chromium${suffix}-${version}";
|
|
|
|
inherit version;
|
2014-03-22 17:05:14 +01:00
|
|
|
|
2017-06-16 07:49:50 +02:00
|
|
|
buildInputs = [
|
|
|
|
makeWrapper ed
|
|
|
|
|
|
|
|
# needed for GSETTINGS_SCHEMAS_PATH
|
2018-02-25 03:23:58 +01:00
|
|
|
gsettings-desktop-schemas glib gtk3
|
2017-06-16 07:49:50 +02:00
|
|
|
|
|
|
|
# needed for XDG_ICON_DIRS
|
2019-02-13 22:47:50 +01:00
|
|
|
gnome3.adwaita-icon-theme
|
2017-06-16 07:49:50 +02:00
|
|
|
];
|
2014-03-22 17:05:14 +01:00
|
|
|
|
2016-08-06 10:13:20 +02:00
|
|
|
outputs = ["out" "sandbox"];
|
|
|
|
|
2014-03-22 17:05:14 +01:00
|
|
|
buildCommand = let
|
|
|
|
browserBinary = "${chromium.browser}/libexec/chromium/chromium";
|
2016-02-02 05:04:41 +01:00
|
|
|
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
|
2019-02-18 09:17:05 +01:00
|
|
|
libPath = stdenv.lib.makeLibraryPath ([]
|
|
|
|
++ stdenv.lib.optional useVaapi libva
|
|
|
|
);
|
|
|
|
|
2014-11-25 13:39:16 +01:00
|
|
|
in with stdenv.lib; ''
|
2016-08-27 17:38:25 +02:00
|
|
|
mkdir -p "$out/bin"
|
2012-06-15 10:19:26 +02:00
|
|
|
|
2016-08-19 20:18:14 +02:00
|
|
|
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
|
2018-03-06 14:00:14 +01:00
|
|
|
--add-flags ${escapeShellArg (escapeShellArg commandLineArgs)} \
|
2016-02-02 05:04:41 +01:00
|
|
|
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
|
2012-06-15 10:19:26 +02:00
|
|
|
|
2016-08-19 20:18:14 +02:00
|
|
|
ed -v -s "$out/bin/chromium" << EOF
|
|
|
|
2i
|
|
|
|
|
2017-01-29 11:11:01 +01:00
|
|
|
if [ -x "/run/wrappers/bin/${sandboxExecutableName}" ]
|
2016-08-19 20:18:14 +02:00
|
|
|
then
|
2017-01-29 11:11:01 +01:00
|
|
|
export CHROME_DEVEL_SANDBOX="/run/wrappers/bin/${sandboxExecutableName}"
|
2016-08-19 20:18:14 +02:00
|
|
|
else
|
|
|
|
export CHROME_DEVEL_SANDBOX="$sandbox/bin/${sandboxExecutableName}"
|
|
|
|
fi
|
|
|
|
|
2019-02-18 09:17:05 +01:00
|
|
|
export LD_LIBRARY_PATH="\$LD_LIBRARY_PATH:${libPath}"
|
|
|
|
|
2016-08-19 20:18:14 +02:00
|
|
|
# libredirect causes chromium to deadlock on startup
|
|
|
|
export LD_PRELOAD="\$(echo -n "\$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\\\.so$ | tr '\n' ':')"
|
|
|
|
|
2017-06-16 07:49:50 +02:00
|
|
|
export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
|
|
|
|
|
2016-08-19 20:18:14 +02:00
|
|
|
.
|
|
|
|
w
|
|
|
|
EOF
|
2016-08-06 10:13:20 +02:00
|
|
|
|
2016-08-06 11:09:40 +02:00
|
|
|
ln -sv "${chromium.browser.sandbox}" "$sandbox"
|
2016-08-06 10:13:20 +02:00
|
|
|
|
2014-09-19 07:51:11 +02:00
|
|
|
ln -s "$out/bin/chromium" "$out/bin/chromium-browser"
|
2016-08-27 17:38:25 +02:00
|
|
|
|
|
|
|
mkdir -p "$out/share/applications"
|
2018-01-22 00:33:47 +01:00
|
|
|
for f in '${chromium.browser}'/share/*; do # hello emacs */
|
2016-08-27 17:38:25 +02:00
|
|
|
ln -s -t "$out/share/" "$f"
|
|
|
|
done
|
2014-03-16 13:32:39 +01:00
|
|
|
cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
|
2014-03-22 17:05:14 +01:00
|
|
|
'';
|
2014-03-23 19:48:53 +01:00
|
|
|
|
2018-01-22 00:33:47 +01:00
|
|
|
inherit (chromium.browser) packageName;
|
|
|
|
meta = chromium.browser.meta // {
|
|
|
|
broken = if enableWideVine then
|
|
|
|
builtins.trace "WARNING: WideVine is not functional, please only use for testing"
|
|
|
|
true
|
|
|
|
else false;
|
|
|
|
};
|
2014-04-01 07:36:26 +02:00
|
|
|
|
|
|
|
passthru = {
|
2016-08-06 15:40:56 +02:00
|
|
|
inherit (chromium) upstream-info browser;
|
2014-04-01 07:36:26 +02:00
|
|
|
mkDerivation = chromium.mkChromiumDerivation;
|
2016-08-06 10:13:20 +02:00
|
|
|
inherit sandboxExecutableName;
|
2014-04-01 07:36:26 +02:00
|
|
|
};
|
2014-03-22 17:05:14 +01:00
|
|
|
}
|