Merge pull request #224605 from Enzime/spotify-wayland

spotify: Add support for `NIXOS_OZONE_WL`
This commit is contained in:
Wout Mertens 2023-04-04 18:28:18 +02:00 committed by GitHub
commit 5c54bec2de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
{ fetchurl, lib, stdenv, squashfsTools, xorg, alsa-lib, makeWrapper, wrapGAppsHook, openssl, freetype { fetchurl, lib, stdenv, squashfsTools, xorg, alsa-lib, makeShellWrapper, wrapGAppsHook, openssl, freetype
, glib, pango, cairo, atk, gdk-pixbuf, gtk3, cups, nspr, nss, libpng, libnotify , glib, pango, cairo, atk, gdk-pixbuf, gtk3, cups, nspr, nss, libpng, libnotify
, libgcrypt, systemd, fontconfig, dbus, expat, ffmpeg, curlWithGnuTls, zlib, gnome , libgcrypt, systemd, fontconfig, dbus, expat, ffmpeg, curlWithGnuTls, zlib, gnome
, at-spi2-atk, at-spi2-core, libpulseaudio, libdrm, mesa, libxkbcommon , at-spi2-atk, at-spi2-core, libpulseaudio, libdrm, mesa, libxkbcommon
@ -13,14 +13,14 @@ let
# If an update breaks things, one of those might have valuable info: # If an update breaks things, one of those might have valuable info:
# https://aur.archlinux.org/packages/spotify/ # https://aur.archlinux.org/packages/spotify/
# https://community.spotify.com/t5/Desktop-Linux # https://community.spotify.com/t5/Desktop-Linux
version = "1.1.84.716.gc5f8b819"; version = "1.1.99.878.g1e4ccc6e";
# To get the latest stable revision: # To get the latest stable revision:
# curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/spotify?channel=stable' | jq '.download_url,.version,.last_updated' # curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/spotify?channel=stable' | jq '.download_url,.version,.last_updated'
# To get general information: # To get general information:
# curl -H 'Snap-Device-Series: 16' 'https://api.snapcraft.io/v2/snaps/info/spotify' | jq '.' # curl -H 'Snap-Device-Series: 16' 'https://api.snapcraft.io/v2/snaps/info/spotify' | jq '.'
# More examples of api usage: # More examples of api usage:
# https://github.com/canonical-websites/snapcraft.io/blob/master/webapp/publisher/snaps/views.py # https://github.com/canonical-websites/snapcraft.io/blob/master/webapp/publisher/snaps/views.py
rev = "60"; rev = "62";
deps = [ deps = [
alsa-lib alsa-lib
@ -75,7 +75,7 @@ stdenv.mkDerivation {
# fetch from snapcraft instead of the debian repository most repos fetch from. # fetch from snapcraft instead of the debian repository most repos fetch from.
# That is a bit more cumbersome. But the debian repository only keeps the last # That is a bit more cumbersome. But the debian repository only keeps the last
# two versions, while snapcraft should provide versions indefinately: # two versions, while snapcraft should provide versions indefinitely:
# https://forum.snapcraft.io/t/how-can-a-developer-remove-her-his-app-from-snap-store/512 # https://forum.snapcraft.io/t/how-can-a-developer-remove-her-his-app-from-snap-store/512
# This is the next-best thing, since we're not allowed to re-distribute # This is the next-best thing, since we're not allowed to re-distribute
@ -83,10 +83,10 @@ stdenv.mkDerivation {
# https://community.spotify.com/t5/Desktop-Linux/Redistribute-Spotify-on-Linux-Distributions/td-p/1695334 # https://community.spotify.com/t5/Desktop-Linux/Redistribute-Spotify-on-Linux-Distributions/td-p/1695334
src = fetchurl { src = fetchurl {
url = "https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_${rev}.snap"; url = "https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_${rev}.snap";
sha512 = "1209b956822d8bb661daa2c88616bed403ec26dc22c6b866cecff59235c56112284c2f99aa06352fc0df6fcd15225a6ad60afd3b4ff4d7b948ab83e70ab31a71"; sha512 = "339r2q13nnpwi7gjd1axc6z2gycfm9gwz3x9dnqyaqd1g3rw7nk6nfbp6bmpkr68lfq1jfgvqwnimcgs84rsi7nmgsiabv3cz0673wv";
}; };
nativeBuildInputs = [ makeWrapper wrapGAppsHook squashfsTools ]; nativeBuildInputs = [ wrapGAppsHook makeShellWrapper squashfsTools ];
dontStrip = true; dontStrip = true;
dontPatchELF = true; dontPatchELF = true;
@ -144,13 +144,14 @@ stdenv.mkDerivation {
--set-rpath $rpath $out/share/spotify/spotify --set-rpath $rpath $out/share/spotify/spotify
librarypath="${lib.makeLibraryPath deps}:$libdir" librarypath="${lib.makeLibraryPath deps}:$libdir"
wrapProgram $out/share/spotify/spotify \ wrapProgramShell $out/share/spotify/spotify \
''${gappsWrapperArgs[@]} \ ''${gappsWrapperArgs[@]} \
${lib.optionalString (deviceScaleFactor != null) '' ${lib.optionalString (deviceScaleFactor != null) ''
--add-flags "--force-device-scale-factor=${toString deviceScaleFactor}" \ --add-flags "--force-device-scale-factor=${toString deviceScaleFactor}" \
''} \ ''} \
--prefix LD_LIBRARY_PATH : "$librarypath" \ --prefix LD_LIBRARY_PATH : "$librarypath" \
--prefix PATH : "${gnome.zenity}/bin" --prefix PATH : "${gnome.zenity}/bin" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
# fix Icon line in the desktop file (#48062) # fix Icon line in the desktop file (#48062)
sed -i "s:^Icon=.*:Icon=spotify-client:" "$out/share/spotify/spotify.desktop" sed -i "s:^Icon=.*:Icon=spotify-client:" "$out/share/spotify/spotify.desktop"

View File

@ -78,6 +78,7 @@ sed --regexp-extended \
# try to build the updated version # try to build the updated version
# #
export NIXPKGS_ALLOW_UNFREE=1
if ! nix-build -A spotify "$nixpkgs"; then if ! nix-build -A spotify "$nixpkgs"; then
echo "The updated spotify failed to build." echo "The updated spotify failed to build."
exit 1 exit 1