Compare commits

...

3 commits

Author SHA1 Message Date
3a1eb9d320
Vivaldi overlay for v6.9
Some checks failed
Build / nix-build (native-aarch64, varda) (push) Successful in 2m31s
Build / nix-build (native-x86_64, gandalf) (push) Has been cancelled
Build / nix-build (native-x86_64, telchar) (push) Has been cancelled
Build / nix-build (native-x86_64, telperion) (push) Has been cancelled
Build / Nix Build Successful (push) Has been cancelled
2024-09-05 14:25:02 -05:00
f983137f11
flake lock -- update all 2024-09-05 13:51:42 -05:00
e2ec473deb
no .idea 2024-09-05 12:19:44 -05:00
7 changed files with 259 additions and 22 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ result*
.kube
.github
.profile
.idea

View file

@ -189,11 +189,11 @@
"zig": "zig"
},
"locked": {
"lastModified": 1725470913,
"narHash": "sha256-129LChuzdtMKExUope96dwyf43Gd1cR+ISvMYIXj+30=",
"lastModified": 1725551137,
"narHash": "sha256-UuWJJ93rcBTp/mG8P5VmM+Z3IrUeWcSsPqmws/ehAw4=",
"ref": "refs/heads/main",
"rev": "125982a5e2b6c2b60caa7ef6740bd81db9c45a5b",
"revCount": 7191,
"rev": "a3aa5463a1417bb052a07386108956dfae271b43",
"revCount": 7197,
"type": "git",
"url": "ssh://git@github.com/ghostty-org/ghostty"
},
@ -367,11 +367,11 @@
]
},
"locked": {
"lastModified": 1725413730,
"narHash": "sha256-eK+iXeWocH0dbcRc+nkk/nbOxTIRtcFQElyBlvjkRqk=",
"lastModified": 1725500139,
"narHash": "sha256-drJz8wZ5RORqtPMnYOMZAQZ43SfrMxMnH5EmQMlVV3A=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "ac3869bc15d8baeefcfc2205f2e6c20e6c09620e",
"rev": "33839dcc1d5a9243fb5c18ed72b0e200501b31ff",
"type": "github"
},
"original": {
@ -382,11 +382,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1725457709,
"narHash": "sha256-haDuGfkIJccuEjI1qk4IGBtE/u3o6F3S6H7wQ43lu3g=",
"lastModified": 1725477728,
"narHash": "sha256-ahej1VRqKmWbG7gewty+GlrSBEeGY/J2Zy8Nt8+3fdg=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "858107998e8a679830474333eb9bc5ebc6bc2ec1",
"rev": "880be1ab837e1e9fe0449dae41ac4d034694d4ce",
"type": "github"
},
"original": {
@ -398,11 +398,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"lastModified": 1725407940,
"narHash": "sha256-tiN5Rlg/jiY0tyky+soJZoRzLKbPyIdlQ77xVgREDNM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"rev": "6f6c45b5134a8ee2e465164811e451dcb5ad86e3",
"type": "github"
},
"original": {
@ -490,11 +490,11 @@
},
"nixpkgs-unstable_2": {
"locked": {
"lastModified": 1725103162,
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
"lastModified": 1725432240,
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
"type": "github"
},
"original": {
@ -542,11 +542,11 @@
},
"nur": {
"locked": {
"lastModified": 1725455714,
"narHash": "sha256-vCbi2P0N0VmXJHOglyYZx7FodiuwpmZA0FHC5/a7GD0=",
"lastModified": 1725554528,
"narHash": "sha256-adxS5UCDN0H0onUlktE6lWkxmxB59gWkay+1sbTuoTo=",
"owner": "nix-community",
"repo": "NUR",
"rev": "b81749ae0f8df9a319189ea65f2bf3e5dff2eaab",
"rev": "1cf6027546907c5ce7b0c6e21b0f507236eaf830",
"type": "github"
},
"original": {
@ -707,11 +707,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1725201042,
"narHash": "sha256-lj5pxOwidP0W//E7IvyhbhXrnEUW99I07+QpERnzTS4=",
"lastModified": 1725540166,
"narHash": "sha256-htc9rsTMSAY5ek+DB3tpntdD/es0eam2hJgO92bWSys=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "5db5921e40ae382d6716dce591ea23b0a39d96f7",
"rev": "d9d781523a1463965cd1e1333a306e70d9feff07",
"type": "github"
},
"original": {

View file

@ -2,6 +2,12 @@
let
inherit (inputs.nixpkgs) lib;
termiusOverlay = import ./termius { };
# vivaldiOverlay = import ./vivaldi { };
vivaldiOverlay = self: super: {
vivaldi = super.callPackage ./vivaldi { };
};
talosctlOverlay = self: super: {
talosctl = super.callPackage ./talosctl/talosctl-custom.nix { };
};
@ -13,6 +19,7 @@ let
in
{
nur = inputs.nur.overlay;
vivaldi = vivaldiOverlay;
# termius = termiusOverlay;
# talosctl = talosctlOverlay;

View file

@ -0,0 +1,135 @@
{ lib, stdenv, fetchurl, zlib, libX11, libXext, libSM, libICE, libxkbcommon, libxshmfence
, libXfixes, libXt, libXi, libXcursor, libXScrnSaver, libXcomposite, libXdamage, libXtst, libXrandr
, alsa-lib, dbus, cups, libexif, ffmpeg, systemd, libva, libGL
, freetype, fontconfig, libXft, libXrender, libxcb, expat
, libuuid
, libxml2
, glib, gtk3, pango, gdk-pixbuf, cairo, atk, at-spi2-atk, at-spi2-core
, qt5
, libdrm, mesa
, vulkan-loader
, nss, nspr
, patchelf, makeWrapper
, wayland, pipewire
, isSnapshot ? false
, proprietaryCodecs ? false, vivaldi-ffmpeg-codecs ? null
, enableWidevine ? false, widevine-cdm ? null
, commandLineArgs ? ""
, pulseSupport ? stdenv.isLinux, libpulseaudio
, kerberosSupport ? true, libkrb5
}:
let
branch = if isSnapshot then "snapshot" else "stable";
vivaldiName = if isSnapshot then "vivaldi-snapshot" else "vivaldi";
in stdenv.mkDerivation rec {
pname = "vivaldi";
version = "6.9.3447.37";
suffix = {
aarch64-linux = "arm64";
x86_64-linux = "amd64";
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
src = fetchurl {
url = "https://downloads.vivaldi.com/${branch}/vivaldi-${branch}_${version}-1_${suffix}.deb";
hash = {
aarch64-linux = "sha256-kYTnWad/jrJt9z+AhjXzHYxVSIwIIO3RKD7szuPEg2s=";
x86_64-linux = "sha256-+h7SHci8gZ+epKFHD0PiXyME2xT+loD2KXpJGFCfIFg=";
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
unpackPhase = ''
ar vx $src
tar -xvf data.tar.xz
'';
nativeBuildInputs = [ patchelf makeWrapper ];
dontWrapQtApps = true;
buildInputs = [
stdenv.cc.cc stdenv.cc.libc zlib libX11 libXt libXext libSM libICE libxcb libxkbcommon libxshmfence
libXi libXft libXcursor libXfixes libXScrnSaver libXcomposite libXdamage libXtst libXrandr
atk at-spi2-atk at-spi2-core alsa-lib dbus cups gtk3 gdk-pixbuf libexif ffmpeg systemd libva
qt5.qtbase
freetype fontconfig libXrender libuuid expat glib nss nspr libGL
libxml2 pango cairo
libdrm mesa vulkan-loader
wayland pipewire
] ++ lib.optional proprietaryCodecs vivaldi-ffmpeg-codecs
++ lib.optional pulseSupport libpulseaudio
++ lib.optional kerberosSupport libkrb5;
libPath = lib.makeLibraryPath buildInputs
+ lib.optionalString (stdenv.is64bit)
(":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs)
+ ":$out/opt/${vivaldiName}/lib";
buildPhase = ''
runHook preBuild
echo "Patching Vivaldi binaries"
for f in chrome_crashpad_handler vivaldi-bin vivaldi-sandbox ; do
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
opt/${vivaldiName}/$f
done
for f in libGLESv2.so libqt5_shim.so ; do
patchelf --set-rpath "${libPath}" opt/${vivaldiName}/$f
done
'' + lib.optionalString proprietaryCodecs ''
ln -s ${vivaldi-ffmpeg-codecs}/lib/libffmpeg.so opt/${vivaldiName}/libffmpeg.so.''${version%\.*\.*}
'' + ''
echo "Finished patching Vivaldi binaries"
runHook postBuild
'';
dontPatchELF = true;
dontStrip = true;
installPhase = ''
runHook preInstall
mkdir -p "$out"
cp -r opt "$out"
mkdir "$out/bin"
ln -s "$out/opt/${vivaldiName}/${vivaldiName}" "$out/bin/vivaldi"
mkdir -p "$out/share"
cp -r usr/share/{applications,xfce4} "$out"/share
substituteInPlace "$out"/share/applications/*.desktop \
--replace /usr/bin/${vivaldiName} "$out"/bin/vivaldi
substituteInPlace "$out"/share/applications/*.desktop \
--replace vivaldi-stable vivaldi
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 \
"$out"/opt/${vivaldiName}/product_logo_''${d}.png \
"$out"/share/icons/hicolor/''${d}x''${d}/apps/vivaldi.png
done
wrapProgram "$out/bin/vivaldi" \
--add-flags ${lib.escapeShellArg commandLineArgs} \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--set-default FONTCONFIG_FILE "${fontconfig.out}/etc/fonts/fonts.conf" \
--set-default FONTCONFIG_PATH "${fontconfig.out}/etc/fonts" \
--suffix XDG_DATA_DIRS : ${gtk3}/share/gsettings-schemas/${gtk3.name}/ \
${lib.optionalString enableWidevine "--suffix LD_LIBRARY_PATH : ${libPath}"}
'' + lib.optionalString enableWidevine ''
ln -sf ${widevine-cdm}/share/google/chrome/WidevineCdm $out/opt/${vivaldiName}/WidevineCdm
'' + ''
runHook postInstall
'';
passthru.updateScript = ./update-vivaldi.sh;
meta = with lib; {
description = "Browser for our Friends, powerful and personal";
homepage = "https://vivaldi.com";
license = licenses.unfree;
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
mainProgram = "vivaldi";
maintainers = with maintainers; [ otwieracz badmutex ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
}

View file

@ -0,0 +1,32 @@
{ squashfsTools, fetchurl, lib, stdenv }:
# This derivation roughly follows the update-ffmpeg script that ships with the official Vivaldi
# downloads at https://vivaldi.com/download/
stdenv.mkDerivation rec {
pname = "chromium-codecs-ffmpeg-extra";
version = "115541";
src = fetchurl {
url = "https://api.snapcraft.io/api/v1/snaps/download/XXzVIXswXKHqlUATPqGCj2w2l7BxosS8_41.snap";
hash = "sha256-a1peHhku+OaGvPyChvLdh6/7zT+v8OHNwt60QUq7VvU=";
};
buildInputs = [ squashfsTools ];
unpackPhase = ''
unsquashfs -dest . $src
'';
installPhase = ''
install -vD chromium-ffmpeg-${version}/chromium-ffmpeg/libffmpeg.so $out/lib/libffmpeg.so
'';
meta = with lib; {
description = "Additional support for proprietary codecs for Vivaldi";
homepage = "https://ffmpeg.org/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.lgpl21;
maintainers = with maintainers; [ betaboon cawilliamson fptje ];
platforms = [ "x86_64-linux" ];
};
}

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
set -eu -o pipefail
version=$(curl -sS https://vivaldi.com/download/ | sed -rne 's/.*vivaldi-stable_([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)-1_amd64\.deb.*/\1/p')
update_hash() {
url="https://downloads.vivaldi.com/stable/vivaldi-stable_$version-1_$2.deb"
hash=$(nix hash to-sri --type sha256 $(nix-prefetch-url --type sha256 "$url"))
update-source-version vivaldi "$version" "$hash" --system=$1 --ignore-same-version
}
update_hash aarch64-linux arm64
update_hash x86_64-linux amd64

View file

@ -0,0 +1,47 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p libarchive curl common-updater-scripts
set -eu -o pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
root=../../../../..
export NIXPKGS_ALLOW_UNFREE=1
version() {
(cd "$root" && nix-instantiate --eval --strict -A "$1.version" | tr -d '"')
}
vivaldi_version_old=$(version vivaldi)
vivaldi_version=$(curl -sS https://vivaldi.com/download/ | sed -rne 's/.*vivaldi-stable_([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)-1_amd64\.deb.*/\1/p')
if [[ ! "$vivaldi_version" = "$vivaldi_version_old" ]]; then
echo "vivaldi is not up-to-date, not updating codecs"
(cd "$root" && nix-shell maintainers/scripts/update.nix --argstr package vivaldi)
exit
fi
echo "vivaldi is up-to-date, updating codecs"
# Download vivaldi and save file path.
url="https://downloads.vivaldi.com/stable/vivaldi-stable_${vivaldi_version}-1_amd64.deb"
mapfile -t prefetch < <(nix-prefetch-url --print-path "$url")
path=${prefetch[1]}
nixpkgs="$(git rev-parse --show-toplevel)"
default_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/default.nix"
ffmpeg_nix="$nixpkgs/pkgs/applications/networking/browsers/vivaldi/ffmpeg-codecs.nix"
# Check vivaldi-ffmpeg-codecs version.
chromium_version_old=$(version vivaldi-ffmpeg-codecs)
ffmpeg_update_script=$(bsdtar xOf "$path" data.tar.xz | bsdtar xOf - ./opt/vivaldi/update-ffmpeg)
chromium_version=$(sed -rne 's/^FFMPEG_VERSION_DEB\=([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/p' <<< $ffmpeg_update_script)
download_subdir=$(sed -rne 's/.*FFMPEG_URL_DEB\=https:\/\/launchpadlibrarian\.net\/([0-9]+)\/.*_amd64\.deb/\1/p' <<< $ffmpeg_update_script)
if [[ "$chromium_version" != "$chromium_version_old" ]]; then
# replace the download prefix
sed -i $ffmpeg_nix -e "s/\(https:\/\/launchpadlibrarian\.net\/\)[0-9]\+/\1$download_subdir/g"
(cd "$root" && update-source-version vivaldi-ffmpeg-codecs "$chromium_version")
git add "${ffmpeg_nix}"
git commit -m "vivaldi-ffmpeg-codecs: $chromium_version_old -> $chromium_version"
fi