2016-08-19 11:18:14 -07:00
|
|
|
{ newScope, stdenv, makeWrapper, makeDesktopItem, ed
|
2018-02-24 18:23:58 -08:00
|
|
|
, glib, gtk3, gnome3, gsettings-desktop-schemas
|
2012-12-03 08:55:09 -08:00
|
|
|
|
2012-12-03 09:23:49 -08:00
|
|
|
# package customization
|
2012-12-03 08:55:09 -08:00
|
|
|
, channel ? "stable"
|
2012-12-03 09:23:49 -08:00
|
|
|
, enableNaCl ? false
|
2015-06-18 19:15:49 -07:00
|
|
|
, enableHotwording ? false
|
2016-09-13 10:42:55 -07:00
|
|
|
, gnomeSupport ? false, gnome ? null
|
2014-03-19 04:21:10 -07:00
|
|
|
, gnomeKeyringSupport ? false
|
2012-12-03 09:23:49 -08:00
|
|
|
, proprietaryCodecs ? true
|
2014-03-19 03:32:39 -07:00
|
|
|
, enablePepperFlash ? false
|
2014-09-29 21:00:47 -07:00
|
|
|
, enableWideVine ? false
|
2014-12-07 05:52:36 -08:00
|
|
|
, cupsSupport ? true
|
2014-03-19 04:21:10 -07:00
|
|
|
, pulseSupport ? false
|
2017-01-05 08:46:37 -08: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 01:19:22 -07:00
|
|
|
}:
|
2009-10-30 01:45:58 -07: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 01:19:22 -07:00
|
|
|
let
|
2014-03-19 04:21:10 -07:00
|
|
|
callPackage = newScope chromium;
|
2014-03-19 03:32:39 -07:00
|
|
|
|
2014-03-19 04:21:10 -07:00
|
|
|
chromium = {
|
2016-05-04 13:11:50 -07:00
|
|
|
upstream-info = (callPackage ./update.nix {}).getChannel channel;
|
2014-03-19 04:51:39 -07:00
|
|
|
|
2016-10-28 19:05:53 -07:00
|
|
|
mkChromiumDerivation = callPackage ./common.nix {
|
2017-02-08 11:42:06 -08:00
|
|
|
inherit enableNaCl enableHotwording gnomeSupport gnome
|
2016-11-08 11:18:15 -08:00
|
|
|
gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport
|
|
|
|
enableWideVine;
|
2014-03-19 04:57:49 -07:00
|
|
|
};
|
|
|
|
|
2016-05-04 08:37:34 -07:00
|
|
|
browser = callPackage ./browser.nix { inherit channel; };
|
2014-03-22 09:05:14 -07:00
|
|
|
|
2014-03-19 04:57:49 -07:00
|
|
|
plugins = callPackage ./plugins.nix {
|
2016-11-01 03:39:34 -07:00
|
|
|
inherit enablePepperFlash enableWideVine;
|
2014-03-19 03:32:39 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2014-03-16 05:32:39 -07:00
|
|
|
desktopItem = makeDesktopItem {
|
2017-03-05 06:02:56 -08:00
|
|
|
name = "chromium-browser";
|
2015-08-04 14:35:13 -07:00
|
|
|
exec = "chromium %U";
|
2015-08-13 20:19:38 -07:00
|
|
|
icon = "chromium";
|
2014-03-16 05:32:39 -07:00
|
|
|
comment = "An open source web browser from Google";
|
|
|
|
desktopName = "Chromium";
|
|
|
|
genericName = "Web browser";
|
2014-04-19 22:01:37 -07: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 03:10:20 -08:00
|
|
|
"x-scheme-handler/about"
|
|
|
|
"x-scheme-handler/unknown"
|
2014-04-19 22:01:37 -07:00
|
|
|
];
|
2014-03-16 05:32:39 -07:00
|
|
|
categories = "Network;WebBrowser";
|
2016-02-29 11:42:58 -08:00
|
|
|
extraEntries = ''
|
|
|
|
StartupWMClass=chromium-browser
|
|
|
|
'';
|
2014-03-16 05:32:39 -07:00
|
|
|
};
|
|
|
|
|
2014-11-25 01:08:28 -08:00
|
|
|
suffix = if channel != "stable" then "-" + channel else "";
|
|
|
|
|
2016-08-06 01:13:20 -07:00
|
|
|
sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName;
|
|
|
|
|
2017-06-15 22:49:50 -07:00
|
|
|
version = chromium.browser.version;
|
|
|
|
|
|
|
|
inherit (stdenv.lib) versionAtLeast;
|
|
|
|
|
2014-03-22 09:05:14 -07:00
|
|
|
in stdenv.mkDerivation {
|
2017-06-15 22:49:50 -07:00
|
|
|
name = "chromium${suffix}-${version}";
|
|
|
|
inherit version;
|
2014-03-22 09:05:14 -07:00
|
|
|
|
2017-06-15 22:49:50 -07:00
|
|
|
buildInputs = [
|
|
|
|
makeWrapper ed
|
|
|
|
|
|
|
|
# needed for GSETTINGS_SCHEMAS_PATH
|
2018-02-24 18:23:58 -08:00
|
|
|
gsettings-desktop-schemas glib gtk3
|
2017-06-15 22:49:50 -07:00
|
|
|
|
|
|
|
# needed for XDG_ICON_DIRS
|
2017-07-31 01:01:15 -07:00
|
|
|
gnome3.defaultIconTheme
|
2017-06-15 22:49:50 -07:00
|
|
|
];
|
2014-03-22 09:05:14 -07:00
|
|
|
|
2016-08-06 01:13:20 -07:00
|
|
|
outputs = ["out" "sandbox"];
|
|
|
|
|
2014-03-22 09:05:14 -07:00
|
|
|
buildCommand = let
|
|
|
|
browserBinary = "${chromium.browser}/libexec/chromium/chromium";
|
2016-02-01 20:04:41 -08:00
|
|
|
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
|
2014-11-25 04:39:16 -08:00
|
|
|
in with stdenv.lib; ''
|
2016-08-27 08:38:25 -07:00
|
|
|
mkdir -p "$out/bin"
|
2012-06-15 01:19:26 -07:00
|
|
|
|
2016-08-19 11:18:14 -07:00
|
|
|
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
|
2017-01-05 08:46:37 -08:00
|
|
|
${commandLineArgs} \
|
2016-02-01 20:04:41 -08:00
|
|
|
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
|
2012-06-15 01:19:26 -07:00
|
|
|
|
2016-08-19 11:18:14 -07:00
|
|
|
ed -v -s "$out/bin/chromium" << EOF
|
|
|
|
2i
|
|
|
|
|
2017-01-29 02:11:01 -08:00
|
|
|
if [ -x "/run/wrappers/bin/${sandboxExecutableName}" ]
|
2016-08-19 11:18:14 -07:00
|
|
|
then
|
2017-01-29 02:11:01 -08:00
|
|
|
export CHROME_DEVEL_SANDBOX="/run/wrappers/bin/${sandboxExecutableName}"
|
2016-08-19 11:18:14 -07:00
|
|
|
else
|
|
|
|
export CHROME_DEVEL_SANDBOX="$sandbox/bin/${sandboxExecutableName}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 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-15 22:49:50 -07:00
|
|
|
export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
|
|
|
|
|
2016-08-19 11:18:14 -07:00
|
|
|
.
|
|
|
|
w
|
|
|
|
EOF
|
2016-08-06 01:13:20 -07:00
|
|
|
|
2016-08-06 02:09:40 -07:00
|
|
|
ln -sv "${chromium.browser.sandbox}" "$sandbox"
|
2016-08-06 01:13:20 -07:00
|
|
|
|
2014-09-18 22:51:11 -07:00
|
|
|
ln -s "$out/bin/chromium" "$out/bin/chromium-browser"
|
2016-08-27 08:38:25 -07:00
|
|
|
|
|
|
|
mkdir -p "$out/share/applications"
|
2018-01-21 15:33:47 -08:00
|
|
|
for f in '${chromium.browser}'/share/*; do # hello emacs */
|
2016-08-27 08:38:25 -07:00
|
|
|
ln -s -t "$out/share/" "$f"
|
|
|
|
done
|
2014-03-16 05:32:39 -07:00
|
|
|
cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
|
2014-03-22 09:05:14 -07:00
|
|
|
'';
|
2014-03-23 11:48:53 -07:00
|
|
|
|
2018-01-21 15:33:47 -08: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-03-31 22:36:26 -07:00
|
|
|
|
|
|
|
passthru = {
|
2016-08-06 06:40:56 -07:00
|
|
|
inherit (chromium) upstream-info browser;
|
2014-03-31 22:36:26 -07:00
|
|
|
mkDerivation = chromium.mkChromiumDerivation;
|
2016-08-06 01:13:20 -07:00
|
|
|
inherit sandboxExecutableName;
|
2014-03-31 22:36:26 -07:00
|
|
|
};
|
2014-03-22 09:05:14 -07:00
|
|
|
}
|