push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
{
stdenv,
pname,
meta,
fetchurl,
undmg,
updateScript,
lib,
}:
stdenv.mkDerivation {
inherit pname;
version = "1.2.72.438";
src =
# WARNING: This Wayback Machine URL redirects to the closest timestamp.
# Future maintainers must manually check the timestamp exists and exactly matches at:
# https://web.archive.org/web/*/https://download.scdn.co/SpotifyARM64.dmg
# https://web.archive.org/web/*/https://download.scdn.co/Spotify.dmg
if stdenv.hostPlatform.isAarch64 then
(fetchurl {
url = "https://web.archive.org/web/20250912003756/https://download.scdn.co/SpotifyARM64.dmg";
hash = "sha256-K+dwlT4hd/SWbQT23ESZY8gGQ8bf5x5CpepMz5Wd6Ng=";
})
else
(fetchurl {
url = "https://web.archive.org/web/20250912003614/https://download.scdn.co/Spotify.dmg";
hash = "sha256-qGoU8wWfuGvAZR4/998kvoPTqkaJPHASTRyZL8Kitzs=";
});
nativeBuildInputs = [ undmg ];
sourceRoot = ".";
installPhase = ''
runHook preInstall
mkdir -p $out/Applications
cp -r *.app $out/Applications
runHook postInstall
'';
passthru = { inherit updateScript; };
meta = meta // {
maintainers = with lib.maintainers; [
matteopacini
Enzime
];
};
}

View File

@@ -0,0 +1,240 @@
{
fetchurl,
lib,
stdenv,
squashfsTools,
xorg,
alsa-lib,
makeShellWrapper,
wrapGAppsHook3,
openssl,
freetype,
glib,
pango,
cairo,
atk,
gdk-pixbuf,
gtk3,
cups,
nspr,
nss_latest,
libpng,
libnotify,
libgcrypt,
systemd,
fontconfig,
dbus,
expat,
ffmpeg_4,
curlWithGnuTls,
zlib,
zenity,
at-spi2-atk,
at-spi2-core,
libpulseaudio,
libdrm,
libgbm,
libxkbcommon,
pname,
meta,
harfbuzz,
libayatana-appindicator,
libdbusmenu,
libGL,
# High-DPI support: Spotify's --force-device-scale-factor argument
# not added if `null`, otherwise, should be a number.
deviceScaleFactor ? null,
updateScript,
}:
let
deps = [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curlWithGnuTls
dbus
expat
ffmpeg_4 # Requires libavcodec < 59 as of 1.2.9.743.g85d9593d
fontconfig
freetype
gdk-pixbuf
glib
gtk3
harfbuzz
libayatana-appindicator
libdbusmenu
libdrm
libgcrypt
libGL
libnotify
libpng
libpulseaudio
libxkbcommon
libgbm
nss_latest
pango
stdenv.cc.cc
systemd
xorg.libICE
xorg.libSM
xorg.libX11
xorg.libxcb
xorg.libXcomposite
xorg.libXcursor
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXi
xorg.libXrandr
xorg.libXrender
xorg.libXScrnSaver
xorg.libxshmfence
xorg.libXtst
zlib
];
in
stdenv.mkDerivation (finalAttrs: {
inherit pname;
# TO UPDATE: just execute the ./update.sh script (won't do anything if there is no update)
# "rev" decides what is actually being downloaded
# If an update breaks things, one of those might have valuable info:
# https://aur.archlinux.org/packages/spotify/
# https://community.spotify.com/t5/Desktop-Linux
version = "1.2.63.394.g126b0d89";
# 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'
# To get general information:
# curl -H 'Snap-Device-Series: 16' 'https://api.snapcraft.io/v2/snaps/info/spotify' | jq '.'
# More examples of api usage:
# https://github.com/canonical-websites/snapcraft.io/blob/master/webapp/publisher/snaps/views.py
rev = "88";
# 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
# 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
# This is the next-best thing, since we're not allowed to re-distribute
# spotify ourselves:
# https://community.spotify.com/t5/Desktop-Linux/Redistribute-Spotify-on-Linux-Distributions/td-p/1695334
src = fetchurl {
name = "spotify-${finalAttrs.version}-${finalAttrs.rev}.snap";
url = "https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_${finalAttrs.rev}.snap";
hash = "sha512-3Jk2YDXSKGJ8hGATGMt8KbOQul1VK/YApmq5j/BWBPjzRVn/j9etzIsYMWCFjpWf4KSvlrZnKuq3gL6SRyDsUA==";
};
nativeBuildInputs = [
wrapGAppsHook3
makeShellWrapper
squashfsTools
];
dontStrip = true;
dontPatchELF = true;
unpackPhase = ''
runHook preUnpack
unsquashfs "$src" '/usr/share/spotify' '/usr/bin/spotify' '/meta/snap.yaml'
cd squashfs-root
if ! grep -q 'grade: stable' meta/snap.yaml; then
# Unfortunately this check is not reliable: At the moment (2018-07-26) the
# latest version in the "edge" channel is also marked as stable.
echo "The snap package is marked as unstable:"
grep 'grade: ' meta/snap.yaml
echo "You probably chose the wrong revision."
exit 1
fi
if ! grep -q '${finalAttrs.version}' meta/snap.yaml; then
echo "Package version differs from version found in snap metadata:"
grep 'version: ' meta/snap.yaml
echo "While the nix package specifies: ${finalAttrs.version}."
echo "You probably chose the wrong revision or forgot to update the nix version."
exit 1
fi
runHook postUnpack
'';
# Prevent double wrapping
dontWrapGApps = true;
env = rec {
libdir = "${placeholder "out"}/lib/spotify";
librarypath = "${lib.makeLibraryPath deps}:${libdir}";
};
installPhase = ''
runHook preInstall
mkdir -p $libdir
mv ./usr/* $out/
# Work around Spotify referring to a specific minor version of
# OpenSSL.
ln -s ${lib.getLib openssl}/lib/libssl.so $libdir/libssl.so.1.0.0
ln -s ${lib.getLib openssl}/lib/libcrypto.so $libdir/libcrypto.so.1.0.0
ln -s ${nspr.out}/lib/libnspr4.so $libdir/libnspr4.so
ln -s ${nspr.out}/lib/libplc4.so $libdir/libplc4.so
ln -s ${ffmpeg_4.lib}/lib/libavcodec.so* $libdir
ln -s ${ffmpeg_4.lib}/lib/libavformat.so* $libdir
rpath="$out/share/spotify:$libdir"
chmod +w "$out/share/spotify/spotify"
patchelf \
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $rpath $out/share/spotify/spotify
# fix Icon line in the desktop file (#48062)
sed -i "s:^Icon=.*:Icon=spotify-client:" "$out/share/spotify/spotify.desktop"
# Desktop file
mkdir -p "$out/share/applications/"
cp "$out/share/spotify/spotify.desktop" "$out/share/applications/"
# Icons
for i in 16 22 24 32 48 64 128 256 512; do
ixi="$i"x"$i"
mkdir -p "$out/share/icons/hicolor/$ixi/apps"
ln -s "$out/share/spotify/icons/spotify-linux-$i.png" \
"$out/share/icons/hicolor/$ixi/apps/spotify-client.png"
done
runHook postInstall
'';
fixupPhase = ''
runHook preFixup
wrapProgramShell $out/share/spotify/spotify \
''${gappsWrapperArgs[@]} \
${
lib.optionalString (deviceScaleFactor != null) ''
--add-flags "--force-device-scale-factor=${toString deviceScaleFactor}" \
''
} \
--prefix LD_LIBRARY_PATH : "$librarypath" \
--prefix PATH : "${zenity}/bin" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime=true}}"
runHook postFixup
'';
passthru = { inherit updateScript; };
meta = meta // {
maintainers = with lib.maintainers; [
ftrvxmtrx
sheenobu
timokau
ma27
];
};
})

View File

@@ -0,0 +1,32 @@
{
lib,
stdenv,
callPackage,
...
}@args:
let
extraArgs = removeAttrs args [ "callPackage" ];
pname = "spotify";
updateScript = ./update.sh;
meta = with lib; {
homepage = "https://www.spotify.com/";
description = "Play music from the Spotify music service";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
mainProgram = "spotify";
};
in
if stdenv.hostPlatform.isDarwin then
callPackage ./darwin.nix (extraArgs // { inherit pname updateScript meta; })
else
callPackage ./linux.nix (extraArgs // { inherit pname updateScript meta; })

116
pkgs/by-name/sp/spotify/update.sh Executable file
View File

@@ -0,0 +1,116 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p common-updater-scripts curl jq git gnused gnugrep libplist undmg
set -euo pipefail
# executing this script without arguments will
# - find the newest stable spotify version avaiable on snapcraft (https://snapcraft.io/spotify)
# - read the current spotify version from the current nix expression
# - update the nix expression if the versions differ
# - try to build the updated version, exit if that fails
# - give instructions for upstreaming
# Please test the update manually before pushing. There have been errors before
# and because the service is proprietary and a paid account is necessary to do
# anything with spotify automatic testing is not possible.
# As an optional argument you can specify the snapcraft channel to update to.
# Default is `stable` and only stable updates should be pushed to nixpkgs. For
# testing you may specify `candidate` or `edge`.
channel="${1:-stable}" # stable/candidate/edge
nixpkgs="$(git rev-parse --show-toplevel)"
update_linux() {
nix_file="$nixpkgs/pkgs/by-name/sp/spotify/linux.nix"
#
# find the newest stable spotify version available on snapcraft
#
# create bash array from snap info
snap_info=($(
curl -s -H 'X-Ubuntu-Series: 16' \
"https://api.snapcraft.io/api/v1/snaps/details/spotify?channel=$channel" \
| jq --raw-output \
'.revision,.download_sha512,.version,.last_updated'
))
# "revision" is the actual version identifier on snapcraft, the "version" is
# just for human consumption. Revision is just an integer that gets increased
# by one every (stable or unstable) release.
revision="${snap_info[0]}"
# We need to escape the slashes
hash="$(nix-hash --to-sri --type sha512 ${snap_info[1]} | sed 's|/|\\/|g')"
upstream_version="${snap_info[2]}"
last_updated="${snap_info[3]}"
echo "Latest $channel release for Spotify on Linux is $upstream_version from $last_updated."
#
# read the current spotify version from the currently *committed* nix expression
#
current_nix_version=$(
grep 'version\s*=' "$nix_file" \
| sed -Ene 's/.*"(.*)".*/\1/p'
)
echo "Current Spotify for Linux version in Nixpkgs: $current_nix_version"
#
# update the nix expression if the versions differ
#
if [[ "$current_nix_version" = "$upstream_version" ]]; then
echo "Spotify on Linux is already up-to-date"
return
fi
echo "Updating Spotify on Linux from ${current_nix_version} to ${upstream_version}, released on ${last_updated}"
# search-and-replace revision, hash and version
sed --regexp-extended \
-e 's/rev\s*=\s*"[0-9]+"\s*;/rev = "'"${revision}"'";/' \
-e 's/hash\s*=\s*"[^"]*"\s*;/hash = "'"${hash}"'";/' \
-e 's/version\s*=\s*".*"\s*;/version = "'"${upstream_version}"'";/' \
-i "$nix_file"
}
update_macos() {
nix_file="$nixpkgs/pkgs/by-name/sp/spotify/darwin.nix"
tmp_dir=$(mktemp -d)
trap 'rm -rf "$tmp_dir"' EXIT
pushd $tmp_dir
x86_64_url="https://download.scdn.co/Spotify.dmg"
aarch64_url="https://download.scdn.co/SpotifyARM64.dmg"
curl -OL $aarch64_url
undmg SpotifyARM64.dmg
upstream_version=$(plistutil -i Spotify.app/Contents/Info.plist -f json -o - | jq -r '.CFBundleVersion')
popd
current_nix_version=$(
grep 'version\s*=' "$nix_file" \
| sed -Ene 's/.*"(.*)".*/\1/p'
)
if [[ "$current_nix_version" != "$upstream_version" ]]; then
archive_url="https://web.archive.org/save"
archived_x86_64_url=$(curl -s -I -L -o /dev/null "$archive_url/$x86_64_url" -w '%{url_effective}')
archived_aarch64_url=$(curl -s -I -L -o /dev/null "$archive_url/$aarch64_url" -w '%{url_effective}')
update-source-version "pkgsCross.x86_64-darwin.spotify" "$upstream_version" "" "$archived_x86_64_url" \
--file=$nix_file \
--ignore-same-version
update-source-version "pkgsCross.aarch64-darwin.spotify" "$upstream_version" "" "$archived_aarch64_url" \
--file=$nix_file \
--ignore-same-version
fi
}
update_linux
update_macos