nixpkgs/pkgs/applications/networking/browsers/chromium/default.nix
aszlig 4f981b4f84
chromium: Move source/default.nix into common.nix
This addresses #12794 so that we now have only a single tarball where we
base our build on instead of splitting the source into different outputs
first and then reference the outputs.

The reason I did this in the first place is that we previously built the
sandbox as a different derivation and unpacking the whole source tree
just for building the sandbox was a bit too much.

As we now have namespaces sandbox built in by default we no longer have
that derivation anymore. It still might come up however if we want to
build NaCl as a separate derivation (see #8560), but splitting the
source code into things only NaCl might require is already too much work
and doesn't weight out the benefits.

Another issue with the source splitup is that Hydra now has an output
limit for non-fixed-output derivations which we're already hitting.

Tested the build against the stable channel and it went well, but I
haven't tested running the browser.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-03-20 17:50:17 +01:00

92 lines
2.5 KiB
Nix

{ newScope, stdenv, makeWrapper, makeDesktopItem
# package customization
, channel ? "stable"
, enableSELinux ? false
, enableNaCl ? false
, enableHotwording ? false
, gnomeSupport ? false
, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enableWideVine ? false
, cupsSupport ? true
, pulseSupport ? false
, hiDPISupport ? false
}:
let
callPackage = newScope chromium;
chromium = {
upstream-info = (import ./update.nix {
inherit (stdenv) system;
}).getChannel channel;
mkChromiumDerivation = callPackage ./common.nix {
inherit enableSELinux enableNaCl enableHotwording gnomeSupport
gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport
hiDPISupport;
};
browser = callPackage ./browser.nix { };
plugins = callPackage ./plugins.nix {
inherit enablePepperFlash enableWideVine;
};
};
desktopItem = makeDesktopItem {
name = "chromium";
exec = "chromium %U";
icon = "chromium";
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";
extraEntries = ''
StartupWMClass=chromium-browser
'';
};
suffix = if channel != "stable" then "-" + channel else "";
in stdenv.mkDerivation {
name = "chromium${suffix}-${chromium.browser.version}";
buildInputs = [ makeWrapper ];
buildCommand = let
browserBinary = "${chromium.browser}/libexec/chromium/chromium";
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
in with stdenv.lib; ''
mkdir -p "$out/bin" "$out/share/applications"
ln -s "${chromium.browser}/share" "$out/share"
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
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;
};
}