nixpkgs/pkgs/applications/networking/browsers/chromium/default.nix
aszlig 0aad4b7ee4
chromium: Update all channels to latest versions.
Overview of the updated versions:

stable: 40.0.2214.91 -> 40.0.2214.115
beta:   41.0.2272.16 -> 41.0.2272.64
dev:    41.0.2272.16 -> 42.0.2305.3

Introduces 42.0.2305.3 as the new dev version, which no longer requires
our user namespaces sandbox patch. Thanks to everyone participating in
https://crbug.com/312380 for finally having this upstream.

In the course of supporting the official namespace sandbox (that's what
the user namespace sandbox is called), a few things needed to be fixed
for version 42:

 * Add an updated nix_plugin_paths.patch, because the old
   one tries to patch the path for libpdf, which is now natively included
   in Chromium.

 * Don't copy libpdf.so to libexec path for version 42, it's no longer
   needed as it's completely built-in now.

 * Disable SUID sandbox directly in the source instead of going the easy
   route of passing --disable-setuid-sandbox. The reason is that with
   the command line flag a nasty nagbar will appear.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-02-22 07:52:52 +01:00

98 lines
2.9 KiB
Nix

{ newScope, stdenv, makeWrapper, makeDesktopItem
# package customization
, channel ? "stable"
, enableSELinux ? false
, enableNaCl ? false
, useOpenSSL ? false
, gnomeSupport ? false
, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enableWideVine ? false
, cupsSupport ? true
, pulseSupport ? false
, hiDPISupport ? false
}:
let
callPackage = newScope chromium;
chromium = {
source = callPackage ./source {
inherit channel;
# XXX: common config
inherit useOpenSSL;
};
mkChromiumDerivation = callPackage ./common.nix {
inherit enableSELinux enableNaCl useOpenSSL gnomeSupport
gnomeKeyringSupport proprietaryCodecs cupsSupport
pulseSupport hiDPISupport;
};
browser = callPackage ./browser.nix { };
sandbox = callPackage ./sandbox.nix { };
plugins = callPackage ./plugins.nix {
inherit enablePepperFlash enableWideVine;
};
};
desktopItem = makeDesktopItem {
name = "chromium";
exec = "chromium";
icon = "${chromium.browser}/share/icons/hicolor/48x48/apps/chromium.png";
comment = "An open source web browser from Google";
desktopName = "Chromium";
genericName = "Web browser";
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"
"x-scheme-handler/about"
"x-scheme-handler/unknown"
];
categories = "Network;WebBrowser";
};
suffix = if channel != "stable" then "-" + channel else "";
in stdenv.mkDerivation {
name = "chromium${suffix}-${chromium.browser.version}";
buildInputs = [ makeWrapper ] ++ chromium.plugins.enabledPlugins;
buildCommand = let
browserBinary = "${chromium.browser}/libexec/chromium/chromium";
sandboxBinary = "${chromium.sandbox}/bin/chromium-sandbox";
mkEnvVar = key: val: "--set '${key}' '${val}'";
envVars = chromium.plugins.settings.envVars or {};
isVer42 = !stdenv.lib.versionOlder chromium.browser.version "42.0.0.0";
flags = chromium.plugins.settings.flags or [];
setBinPath = "--set CHROMIUM_SANDBOX_BINARY_PATH \"${sandboxBinary}\"";
in with stdenv.lib; ''
mkdir -p "$out/bin" "$out/share/applications"
ln -s "${chromium.browser}/share" "$out/share"
makeWrapper "${browserBinary}" "$out/bin/chromium" \
${optionalString (!isVer42) setBinPath} \
${concatStrings (mapAttrsToList mkEnvVar envVars)} \
--add-flags "${concatStringsSep " " flags}"
ln -s "$out/bin/chromium" "$out/bin/chromium-browser"
ln -s "${chromium.browser}/share/icons" "$out/share/icons"
cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
'';
inherit (chromium.browser) meta packageName;
passthru = {
mkDerivation = chromium.mkChromiumDerivation;
};
}