2021-08-28 22:12:27 +01:00
|
|
|
{ lib, mkChromiumDerivation
|
|
|
|
, channel, chromiumVersionAtLeast
|
|
|
|
, enableWideVine, ungoogled
|
|
|
|
}:
|
2014-03-19 11:21:10 +00:00
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
with lib;
|
2014-03-19 11:21:10 +00:00
|
|
|
|
2019-08-11 00:09:55 +01:00
|
|
|
mkChromiumDerivation (base: rec {
|
2014-04-01 06:36:26 +01:00
|
|
|
name = "chromium-browser";
|
2014-04-20 07:39:40 +01:00
|
|
|
packageName = "chromium";
|
2018-02-26 23:04:33 +00:00
|
|
|
buildTargets = [ "mksnapshot" "chrome_sandbox" "chrome" ];
|
2014-03-19 11:21:10 +00:00
|
|
|
|
2016-08-06 14:40:56 +01:00
|
|
|
outputs = ["out" "sandbox"];
|
|
|
|
|
|
|
|
sandboxExecutableName = "__chromium-suid-sandbox";
|
|
|
|
|
2014-03-19 11:57:49 +00:00
|
|
|
installPhase = ''
|
2017-09-15 20:32:13 +01:00
|
|
|
mkdir -p "$libExecPath"
|
2020-10-02 00:22:57 +01:00
|
|
|
cp -v "$buildPath/"*.so "$buildPath/"*.pak "$buildPath/"*.bin "$libExecPath/"
|
2021-11-16 21:04:47 +00:00
|
|
|
cp -v "$buildPath/vk_swiftshader_icd.json" "$libExecPath/"
|
2014-04-01 06:36:26 +01:00
|
|
|
cp -v "$buildPath/icudtl.dat" "$libExecPath/"
|
2014-06-18 11:11:36 +01:00
|
|
|
cp -vLR "$buildPath/locales" "$buildPath/resources" "$libExecPath/"
|
2021-09-24 12:31:41 +01:00
|
|
|
cp -v "$buildPath/chrome_crashpad_handler" "$libExecPath/"
|
2014-04-01 06:36:26 +01:00
|
|
|
cp -v "$buildPath/chrome" "$libExecPath/$packageName"
|
2016-08-06 14:40:56 +01:00
|
|
|
|
2020-03-24 16:37:37 +00:00
|
|
|
# Swiftshader
|
|
|
|
# See https://stackoverflow.com/a/4264351/263061 for the find invocation.
|
|
|
|
if [ -n "$(find "$buildPath/swiftshader/" -maxdepth 1 -name '*.so' -print -quit)" ]; then
|
|
|
|
echo "Swiftshader files found; installing"
|
|
|
|
mkdir -p "$libExecPath/swiftshader"
|
|
|
|
cp -v "$buildPath/swiftshader/"*.so "$libExecPath/swiftshader/"
|
|
|
|
else
|
|
|
|
echo "Swiftshader files not found"
|
|
|
|
fi
|
|
|
|
|
2016-08-06 14:40:56 +01:00
|
|
|
mkdir -p "$sandbox/bin"
|
|
|
|
cp -v "$buildPath/chrome_sandbox" "$sandbox/bin/${sandboxExecutableName}"
|
2014-03-19 11:21:10 +00:00
|
|
|
|
|
|
|
mkdir -vp "$out/share/man/man1"
|
2014-04-01 06:36:26 +01:00
|
|
|
cp -v "$buildPath/chrome.1" "$out/share/man/man1/$packageName.1"
|
2014-03-19 11:21:10 +00:00
|
|
|
|
|
|
|
for icon_file in chrome/app/theme/chromium/product_logo_*[0-9].png; do
|
|
|
|
num_and_suffix="''${icon_file##*logo_}"
|
|
|
|
icon_size="''${num_and_suffix%.*}"
|
|
|
|
expr "$icon_size" : "^[0-9][0-9]*$" || continue
|
|
|
|
logo_output_prefix="$out/share/icons/hicolor"
|
|
|
|
logo_output_path="$logo_output_prefix/''${icon_size}x''${icon_size}/apps"
|
|
|
|
mkdir -vp "$logo_output_path"
|
2014-04-01 06:36:26 +01:00
|
|
|
cp -v "$icon_file" "$logo_output_path/$packageName.png"
|
2014-03-19 11:21:10 +00:00
|
|
|
done
|
2019-04-30 07:05:49 +01:00
|
|
|
|
|
|
|
# Install Desktop Entry
|
|
|
|
install -D chrome/installer/linux/common/desktop.template \
|
|
|
|
$out/share/applications/chromium-browser.desktop
|
|
|
|
|
|
|
|
substituteInPlace $out/share/applications/chromium-browser.desktop \
|
|
|
|
--replace "@@MENUNAME@@" "Chromium" \
|
|
|
|
--replace "@@PACKAGE@@" "chromium" \
|
|
|
|
--replace "Exec=/usr/bin/@@USR_BIN_SYMLINK_NAME@@" "Exec=chromium"
|
|
|
|
|
|
|
|
# Append more mime types to the end
|
|
|
|
sed -i '/^MimeType=/ s,$,x-scheme-handler/webcal;x-scheme-handler/mailto;x-scheme-handler/about;x-scheme-handler/unknown,' \
|
|
|
|
$out/share/applications/chromium-browser.desktop
|
|
|
|
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/12433
|
|
|
|
sed -i \
|
|
|
|
-e '/\[Desktop Entry\]/a\' \
|
|
|
|
-e 'StartupWMClass=chromium-browser' \
|
|
|
|
$out/share/applications/chromium-browser.desktop
|
2021-07-25 12:53:59 +01:00
|
|
|
'';
|
2014-03-19 11:21:10 +00:00
|
|
|
|
2016-08-06 14:40:56 +01:00
|
|
|
passthru = { inherit sandboxExecutableName; };
|
|
|
|
|
2017-01-03 12:54:07 +00:00
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
2014-03-19 11:21:10 +00:00
|
|
|
meta = {
|
2020-12-09 18:13:26 +00:00
|
|
|
description = "An open source web browser from Google"
|
|
|
|
+ optionalString ungoogled ", with dependencies on Google web services removed";
|
2020-01-28 21:37:37 +00:00
|
|
|
longDescription = ''
|
|
|
|
Chromium is an open source web browser from Google that aims to build a
|
|
|
|
safer, faster, and more stable way for all Internet users to experience
|
|
|
|
the web. It has a minimalist user interface and provides the vast majority
|
|
|
|
of source code for Google Chrome (which has some additional features).
|
|
|
|
'';
|
2020-12-09 18:13:26 +00:00
|
|
|
homepage = if ungoogled
|
|
|
|
then "https://github.com/Eloston/ungoogled-chromium"
|
|
|
|
else "https://www.chromium.org/";
|
|
|
|
maintainers = with maintainers; if ungoogled
|
|
|
|
then [ squalus primeos ]
|
2021-07-23 09:38:36 +01:00
|
|
|
else [ primeos thefloweringash ];
|
2019-09-05 22:27:04 +01:00
|
|
|
license = if enableWideVine then licenses.unfree else licenses.bsd3;
|
2014-03-19 11:21:10 +00:00
|
|
|
platforms = platforms.linux;
|
2021-05-03 20:15:27 +01:00
|
|
|
mainProgram = "chromium";
|
2021-07-25 12:50:45 +01:00
|
|
|
hydraPlatforms = if (channel == "stable" || channel == "ungoogled-chromium")
|
2020-12-09 18:29:31 +00:00
|
|
|
then ["aarch64-linux" "x86_64-linux"]
|
|
|
|
else [];
|
2020-10-20 11:59:55 +01:00
|
|
|
timeout = 172800; # 48 hours (increased from the Hydra default of 10h)
|
2014-03-19 11:21:10 +00:00
|
|
|
};
|
2014-04-01 06:36:26 +01:00
|
|
|
})
|