d0e8f3c503
This only uses the most basic GN flags which should represent the GYP flags we had before. In order to get rid most of the GYP cruft, we now have common.nix and common-gn.nix which are mostly the same, just that the latter is only for GN builds. The GN implementation is far from complete and currently not even builds, so we need more work to get the beta and dev channels building. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
123 lines
3.4 KiB
Nix
123 lines
3.4 KiB
Nix
{ newScope, stdenv, makeWrapper, makeDesktopItem, ed
|
|
|
|
# package customization
|
|
, channel ? "stable"
|
|
, enableSELinux ? false
|
|
, enableNaCl ? false
|
|
, enableHotwording ? false
|
|
, gnomeSupport ? false, gnome ? null
|
|
, gnomeKeyringSupport ? false
|
|
, proprietaryCodecs ? true
|
|
, enablePepperFlash ? false
|
|
, enableWideVine ? false
|
|
, cupsSupport ? true
|
|
, pulseSupport ? false
|
|
, hiDPISupport ? false
|
|
}:
|
|
|
|
let
|
|
callPackage = newScope chromium;
|
|
|
|
# XXX: This is an ugly hack for the transition to GN:
|
|
inherit (stdenv.lib) versionAtLeast;
|
|
gnRequired = versionAtLeast chromium.upstream-info.version "54.0.0.0";
|
|
common = if gnRequired then ./common-gn.nix else ./common.nix;
|
|
|
|
chromium = {
|
|
upstream-info = (callPackage ./update.nix {}).getChannel channel;
|
|
|
|
mkChromiumDerivation = callPackage common {
|
|
inherit enableSELinux enableNaCl enableHotwording gnomeSupport gnome
|
|
gnomeKeyringSupport proprietaryCodecs cupsSupport pulseSupport
|
|
hiDPISupport;
|
|
};
|
|
|
|
browser = callPackage ./browser.nix { inherit channel; };
|
|
|
|
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 "";
|
|
|
|
sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName;
|
|
|
|
in stdenv.mkDerivation {
|
|
name = "chromium${suffix}-${chromium.browser.version}";
|
|
|
|
buildInputs = [ makeWrapper ed ];
|
|
|
|
outputs = ["out" "sandbox"];
|
|
|
|
buildCommand = let
|
|
browserBinary = "${chromium.browser}/libexec/chromium/chromium";
|
|
getWrapperFlags = plugin: "$(< \"${plugin}/nix-support/wrapper-flags\")";
|
|
in with stdenv.lib; ''
|
|
mkdir -p "$out/bin"
|
|
|
|
eval makeWrapper "${browserBinary}" "$out/bin/chromium" \
|
|
${concatMapStringsSep " " getWrapperFlags chromium.plugins.enabled}
|
|
|
|
ed -v -s "$out/bin/chromium" << EOF
|
|
2i
|
|
|
|
if [ -x "/var/setuid-wrappers/${sandboxExecutableName}" ]
|
|
then
|
|
export CHROME_DEVEL_SANDBOX="/var/setuid-wrappers/${sandboxExecutableName}"
|
|
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' ':')"
|
|
|
|
.
|
|
w
|
|
EOF
|
|
|
|
ln -sv "${chromium.browser.sandbox}" "$sandbox"
|
|
|
|
ln -s "$out/bin/chromium" "$out/bin/chromium-browser"
|
|
|
|
mkdir -p "$out/share/applications"
|
|
for f in '${chromium.browser}'/share/*; do
|
|
ln -s -t "$out/share/" "$f"
|
|
done
|
|
cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
|
|
'';
|
|
|
|
inherit (chromium.browser) meta packageName;
|
|
|
|
passthru = {
|
|
inherit (chromium) upstream-info browser;
|
|
mkDerivation = chromium.mkChromiumDerivation;
|
|
inherit sandboxExecutableName;
|
|
};
|
|
}
|