nixpkgs/pkgs/applications/networking/browsers/chromium/default.nix

92 lines
2.5 KiB
Nix
Raw Normal View History

{ newScope, stdenv, makeWrapper, makeDesktopItem
# package customization
, channel ? "stable"
, enableSELinux ? false
, enableNaCl ? false
, enableHotwording ? false
, gnomeSupport ? false
, gnomeKeyringSupport ? false
, proprietaryCodecs ? true
, enablePepperFlash ? false
, enableWideVine ? false
2014-12-07 13:52:36 +00:00
, 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;
};
};
2014-03-16 12:32:39 +00:00
desktopItem = makeDesktopItem {
name = "chromium";
exec = "chromium %U";
icon = "chromium";
2014-03-16 12:32:39 +00:00
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"
];
2014-03-16 12:32:39 +00:00
categories = "Network;WebBrowser";
extraEntries = ''
StartupWMClass=chromium-browser
'';
2014-03-16 12:32:39 +00:00
};
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"
2014-03-16 12:32:39 +00:00
cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
'';
inherit (chromium.browser) meta packageName;
passthru = {
mkDerivation = chromium.mkChromiumDerivation;
};
}