Created
December 22, 2017 14:45
-
-
Save mattdenner/bbfd4e6524e8bd493f62af85ca579c84 to your computer and use it in GitHub Desktop.
A hacky overlay for the new spotify client that comes from snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self: super: { | |
spotify = let | |
deps = with super.pkgs; [ | |
alsaLib | |
atk | |
cairo | |
cups | |
curl | |
dbus | |
expat | |
ffmpeg_0_10 | |
fontconfig | |
freetype | |
gnome2.GConf | |
nspr | |
gdk_pixbuf | |
glib | |
gtk2 | |
libgcrypt | |
libpng | |
nss | |
pango | |
stdenv.cc.cc | |
systemd | |
xorg.libX11 | |
xorg.libXcomposite | |
xorg.libXcursor | |
xorg.libXdamage | |
xorg.libXext | |
xorg.libXfixes | |
xorg.libXi | |
xorg.libXrandr | |
xorg.libXrender | |
xorg.libXScrnSaver | |
xorg.libXtst | |
xorg.libxcb | |
zlib | |
]; | |
version = "1.0.70.399.g5ffabd56-26"; | |
in super.pkgs.stdenv.mkDerivation rec { | |
name = "spotify-${version}"; | |
# TODO: find the URL using | |
# curl -H 'X-Ubuntu-Series: 16' https://api.snapcraft.io/api/v1/snaps/details/spotify | jq '.download_url' -r | |
src = super.pkgs.fetchurl { | |
url = "https://api.snapcraft.io/api/v1/snaps/download/pOBIoZ2LrCB3rDohMxoYGnbN14EHOgD7_5.snap"; | |
sha256 = "0p9ihvfavbqs49khh0qdw2j2lq9kk6f0n1p30pp0pk67wd6kq6a7"; | |
}; | |
doConfigure = false; | |
doBuild = false; | |
dontStrip = true; | |
dontPatchELF = true; | |
buildInputs = with super.pkgs; [ squashfsTools makeWrapper ]; | |
unpackPhase = '' | |
runHook preUnpack | |
unsquashfs $src | |
runHook postUnpack | |
''; | |
installPhase = '' | |
runHook preInstall | |
mkdir -p "$out/share/spotify" | |
mv ./squashfs-root/usr/share/spotify/* "$out/share/spotify" | |
patchelf \ | |
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ | |
"$out/share/spotify/spotify" | |
wrapProgram "$out/share/spotify/spotify" \ | |
--prefix LD_LIBRARY_PATH : "${super.pkgs.stdenv.lib.makeLibraryPath deps}" | |
mkdir -p "$out/bin" | |
ln -sf "$out/share/spotify/spotify" "$out/bin/spotify" | |
mkdir -p "$out/share/applications" | |
cp "$out/share/spotify/spotify.desktop" "$out/share/applications/" | |
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 | |
''; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment