diff options
author | Matthijs Steen <emailmatthijs@gmail.com> | 2015-11-08 18:55:47 +0100 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-11-16 15:15:51 +0100 |
commit | 0ceda119d7f125e879358116c05d291780797ef7 (patch) | |
tree | caee1a28dd10a529aff79a13e7bbe17306e25276 /pkgs/applications/networking/browsers/google-chrome | |
parent | 61402311cc49b746f5992d4cbadfd960904dca6c (diff) | |
download | nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar.gz nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar.bz2 nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar.lz nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar.xz nixlib-0ceda119d7f125e879358116c05d291780797ef7.tar.zst nixlib-0ceda119d7f125e879358116c05d291780797ef7.zip |
google-chrome: init at 45.0.2454.101-1 (close #10892)
As suggested the Google Chrome .deb file that is used for Chromium's plugins is reused. vcunat removed lots of newlines, as the style was diverging from the majority far too much (IHHO).
Diffstat (limited to 'pkgs/applications/networking/browsers/google-chrome')
-rw-r--r-- | pkgs/applications/networking/browsers/google-chrome/default.nix | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix new file mode 100644 index 000000000000..b05da9c67000 --- /dev/null +++ b/pkgs/applications/networking/browsers/google-chrome/default.nix @@ -0,0 +1,120 @@ +{ stdenv, buildEnv, fetchurl, patchelf, bash + +# Linked dynamic libraries. +, glib, fontconfig, freetype, pango, cairo, libX11, libXi, atk, gconf, nss, nspr +, libXcursor, libXext, libXfixes, libXrender, libXScrnSaver, libXcomposite +, alsaLib, libXdamage, libXtst, libXrandr, expat, cups +, dbus_libs, gtk, gdk_pixbuf, gcc + +# Will crash without. +, udev + +# Loaded at runtime. +, libexif + +# Additional dependencies according to other distros. +## Ubuntu +, liberation_ttf, curl, utillinux, xdg_utils, wget +## Arch Linux. +, flac, harfbuzz, icu, libpng, libopus, snappy, speechd +## Gentoo +, bzip2, libcap + +# Which distribution channel to use. +, channel ? "stable" + +# Necessary for USB audio devices. +, pulseSupport ? true, libpulseaudio ? null + +}: + +with stdenv.lib; + +with (import ../chromium/source/update.nix { + inherit (stdenv) system; +}).getChannel channel; + +let + dist = if channel == "dev" then "unstable" else channel; + + opusWithCustomModes = libopus.override { + withCustomModes = true; + }; + + env = buildEnv { + name = "google-chrome-env"; + paths = [ + glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr + libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite + alsaLib libXdamage libXtst libXrandr expat cups + dbus_libs gtk gdk_pixbuf gcc + udev + libexif + liberation_ttf curl utillinux xdg_utils wget + flac harfbuzz icu libpng opusWithCustomModes snappy speechd + bzip2 libcap + ] + ++ optional pulseSupport libpulseaudio; + }; +in stdenv.mkDerivation rec { + inherit version; + + name = "google-chrome-${version}"; + + src = fetchurl binary; + + buildInputs = [ env patchelf ]; + + unpackPhase = '' + ar x $src + tar xf data.tar.xz + ''; + + installPhase = '' + exe=$out/bin/google-chrome-${dist} + rpath="${env}/lib:${env}/lib64" + + mkdir -p $out/bin $out/share + + cp -a opt/* $out/share + cp -a usr/share/* $out/share + + substituteInPlace $out/share/applications/google-chrome.desktop \ + --replace /usr/bin/google-chrome-${dist} $exe + substituteInPlace $out/share/gnome-control-center/default-apps/google-chrome.xml \ + --replace /opt/google/chrome/google-chrome $exe + substituteInPlace $out/share/menu/google-chrome.menu \ + --replace /opt $out/share \ + --replace $out/share/google/chrome/google-chrome $exe + + for icon_file in $out/share/google/chrome/product_logo_*[0-9].png; do + num_and_suffix="''${icon_file##*logo_}" + icon_size="''${num_and_suffix%.*}" + logo_output_prefix="$out/share/icons/hicolor" + logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps" + mkdir -p "$logo_output_path" + mv "$icon_file" "$logo_output_path/google-chrome.png" + done + + cat > $exe << EOF + #!${bash}/bin/sh + export LD_LIBRARY_PATH=$rpath\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} + export PATH=${env}/bin\''${PATH:+:\$PATH} + $out/share/google/chrome/google-chrome "\$@" + EOF + chmod +x $exe + + for elf in $out/share/google/chrome/{chrome,chrome-sandbox,nacl_helper}; do + patchelf --set-rpath $rpath $elf + patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $elf + done + ''; + + meta = { + description = "A freeware web browser developed by Google"; + homepage = "https://www.google.com/chrome/browser/"; + license = licenses.unfree; + maintainers = [ maintainers.msteen ]; + platforms = platforms.linux; + }; +} |