2021-03-21 00:37:03 +00:00
|
|
|
{ lib, stdenv, fetchurl, zlib, libX11, libXext, libSM, libICE, libxkbcommon, libxshmfence
|
2016-03-29 11:54:40 +01:00
|
|
|
, libXfixes, libXt, libXi, libXcursor, libXScrnSaver, libXcomposite, libXdamage, libXtst, libXrandr
|
2021-12-22 08:10:55 +00:00
|
|
|
, alsa-lib, dbus, cups, libexif, ffmpeg, systemd, libva
|
2018-07-21 01:44:44 +01:00
|
|
|
, freetype, fontconfig, libXft, libXrender, libxcb, expat
|
|
|
|
, libuuid
|
2020-07-13 16:49:31 +01:00
|
|
|
, libxml2
|
2022-02-11 14:04:50 +00:00
|
|
|
, glib, gtk3, pango, gdk-pixbuf, cairo, atk, at-spi2-atk, at-spi2-core
|
2020-03-07 16:58:52 +00:00
|
|
|
, libdrm, mesa
|
2016-03-29 11:54:40 +01:00
|
|
|
, nss, nspr
|
2017-07-12 10:53:53 +01:00
|
|
|
, patchelf, makeWrapper
|
2019-04-22 03:20:20 +01:00
|
|
|
, isSnapshot ? false
|
2017-10-10 05:54:38 +01:00
|
|
|
, proprietaryCodecs ? false, vivaldi-ffmpeg-codecs ? null
|
2019-06-28 22:52:03 +01:00
|
|
|
, enableWidevine ? false, vivaldi-widevine ? null
|
2021-12-22 09:02:58 +00:00
|
|
|
, commandLineArgs ? ""
|
2022-03-07 16:38:41 +00:00
|
|
|
, pulseSupport ? stdenv.isLinux, libpulseaudio
|
2016-03-29 11:54:40 +01:00
|
|
|
}:
|
|
|
|
|
2019-04-22 03:20:20 +01:00
|
|
|
let
|
|
|
|
branch = if isSnapshot then "snapshot" else "stable";
|
|
|
|
vivaldiName = if isSnapshot then "vivaldi-snapshot" else "vivaldi";
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "vivaldi";
|
2022-03-20 13:18:25 +00:00
|
|
|
version = "5.1.2567.66-1";
|
2017-12-05 16:43:03 +00:00
|
|
|
|
2016-04-29 02:05:41 +01:00
|
|
|
src = fetchurl {
|
2019-04-22 03:20:20 +01:00
|
|
|
url = "https://downloads.vivaldi.com/${branch}/vivaldi-${branch}_${version}_amd64.deb";
|
2022-03-20 13:18:25 +00:00
|
|
|
sha256 = "1v9hcjgvblscpsw8c2nm8x7frzkfv2ph8l5hibyidnfjppx1qqz2";
|
2017-12-05 16:43:03 +00:00
|
|
|
};
|
2016-03-29 11:54:40 +01:00
|
|
|
|
|
|
|
unpackPhase = ''
|
2019-04-22 03:20:20 +01:00
|
|
|
ar vx $src
|
2016-03-29 11:54:40 +01:00
|
|
|
tar -xvf data.tar.xz
|
|
|
|
'';
|
|
|
|
|
2017-07-12 10:53:53 +01:00
|
|
|
nativeBuildInputs = [ patchelf makeWrapper ];
|
2017-06-18 12:45:17 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
2021-03-21 00:37:03 +00:00
|
|
|
stdenv.cc.cc stdenv.cc.libc zlib libX11 libXt libXext libSM libICE libxcb libxkbcommon libxshmfence
|
2017-06-18 12:45:17 +01:00
|
|
|
libXi libXft libXcursor libXfixes libXScrnSaver libXcomposite libXdamage libXtst libXrandr
|
2021-12-22 08:10:55 +00:00
|
|
|
atk at-spi2-atk at-spi2-core alsa-lib dbus cups gtk3 gdk-pixbuf libexif ffmpeg systemd libva
|
2017-06-18 12:45:17 +01:00
|
|
|
freetype fontconfig libXrender libuuid expat glib nss nspr
|
2022-02-11 14:04:50 +00:00
|
|
|
libxml2 pango cairo
|
2020-03-07 16:58:52 +00:00
|
|
|
libdrm mesa
|
2022-03-07 16:38:41 +00:00
|
|
|
] ++ lib.optional proprietaryCodecs vivaldi-ffmpeg-codecs
|
|
|
|
++ lib.optional pulseSupport libpulseaudio;
|
2016-03-29 11:54:40 +01:00
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
libPath = lib.makeLibraryPath buildInputs
|
|
|
|
+ lib.optionalString (stdenv.is64bit)
|
|
|
|
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs)
|
2019-04-22 03:20:20 +01:00
|
|
|
+ ":$out/opt/${vivaldiName}/lib";
|
2016-03-29 11:54:40 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
2021-05-03 15:50:19 +01:00
|
|
|
runHook preBuild
|
2016-03-29 11:54:40 +01:00
|
|
|
echo "Patching Vivaldi binaries"
|
2021-10-13 13:09:25 +01:00
|
|
|
for f in chrome_crashpad_handler vivaldi-bin vivaldi-sandbox ; do
|
2021-08-17 11:50:23 +01:00
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath "${libPath}" \
|
|
|
|
opt/${vivaldiName}/$f
|
|
|
|
done
|
2021-01-15 13:21:58 +00:00
|
|
|
'' + lib.optionalString proprietaryCodecs ''
|
2019-10-29 01:01:31 +00:00
|
|
|
ln -s ${vivaldi-ffmpeg-codecs}/lib/libffmpeg.so opt/${vivaldiName}/libffmpeg.so.''${version%\.*\.*}
|
2017-06-25 13:00:05 +01:00
|
|
|
'' + ''
|
2016-03-29 11:54:40 +01:00
|
|
|
echo "Finished patching Vivaldi binaries"
|
2021-05-03 15:50:19 +01:00
|
|
|
runHook postBuild
|
2016-03-29 11:54:40 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
2021-05-03 15:50:19 +01:00
|
|
|
runHook preInstall
|
2016-03-29 11:54:40 +01:00
|
|
|
mkdir -p "$out"
|
|
|
|
cp -r opt "$out"
|
|
|
|
mkdir "$out/bin"
|
2019-04-22 03:20:20 +01:00
|
|
|
ln -s "$out/opt/${vivaldiName}/${vivaldiName}" "$out/bin/vivaldi"
|
2016-09-23 23:27:36 +01:00
|
|
|
mkdir -p "$out/share"
|
|
|
|
cp -r usr/share/{applications,xfce4} "$out"/share
|
|
|
|
substituteInPlace "$out"/share/applications/*.desktop \
|
2019-04-22 03:20:20 +01:00
|
|
|
--replace /usr/bin/${vivaldiName} "$out"/bin/vivaldi
|
2019-07-20 14:57:49 +01:00
|
|
|
substituteInPlace "$out"/share/applications/*.desktop \
|
|
|
|
--replace vivaldi-stable vivaldi
|
2016-09-23 23:27:36 +01:00
|
|
|
local d
|
|
|
|
for d in 16 22 24 32 48 64 128 256; do
|
|
|
|
mkdir -p "$out"/share/icons/hicolor/''${d}x''${d}/apps
|
|
|
|
ln -s \
|
2019-04-22 03:20:20 +01:00
|
|
|
"$out"/opt/${vivaldiName}/product_logo_''${d}.png \
|
2016-09-23 23:27:36 +01:00
|
|
|
"$out"/share/icons/hicolor/''${d}x''${d}/apps/vivaldi.png
|
|
|
|
done
|
2017-07-12 10:53:53 +01:00
|
|
|
wrapProgram "$out/bin/vivaldi" \
|
2021-12-22 09:02:58 +00:00
|
|
|
--add-flags ${lib.escapeShellArg commandLineArgs} \
|
2019-06-28 22:52:03 +01:00
|
|
|
--suffix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${gtk3.name}/ \
|
2021-01-15 13:21:58 +00:00
|
|
|
${lib.optionalString enableWidevine "--suffix LD_LIBRARY_PATH : ${libPath}"}
|
|
|
|
'' + lib.optionalString enableWidevine ''
|
2019-10-29 01:01:31 +00:00
|
|
|
ln -sf ${vivaldi-widevine}/share/google/chrome/WidevineCdm $out/opt/${vivaldiName}/WidevineCdm
|
2021-05-03 15:50:19 +01:00
|
|
|
'' + ''
|
|
|
|
runHook postInstall
|
2016-03-29 11:54:40 +01:00
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-03-29 11:54:40 +01:00
|
|
|
description = "A Browser for our Friends, powerful and personal";
|
|
|
|
homepage = "https://vivaldi.com";
|
|
|
|
license = licenses.unfree;
|
2020-10-08 15:20:21 +01:00
|
|
|
maintainers = with maintainers; [ otwieracz badmutex ];
|
2017-06-18 12:45:17 +01:00
|
|
|
platforms = [ "x86_64-linux" ];
|
2016-03-29 11:54:40 +01:00
|
|
|
};
|
|
|
|
}
|