From e4d86cbf9814870bb3b6b2ca453c132c30aafba1 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Sun, 14 Feb 2021 17:24:45 +0800 Subject: [PATCH] spotifyd: fix errors - Fixes errors in configuration - Add an overlay to use an older Rust version to build spotifyd until https://github.com/Spotifyd/spotifyd/issues/719 is fixed. --- home/spotify.nix | 2 +- pkgs/default.nix | 1 + pkgs/spotifyd.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 pkgs/spotifyd.nix diff --git a/home/spotify.nix b/home/spotify.nix index 98ca598..ae6a2d2 100644 --- a/home/spotify.nix +++ b/home/spotify.nix @@ -25,7 +25,7 @@ in global = { username = "demoneaux"; device_name = "spotifyd"; - use_keyring = "true"; + use_keyring = true; onevent = "${notificationsScript}"; }; }; diff --git a/pkgs/default.nix b/pkgs/default.nix index 54768bd..7b81ea1 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -6,4 +6,5 @@ final: prev: ttf-console-font = prev.callPackage ./ttf-console-font.nix { }; otf2bdf = prev.callPackage ./otf2bdf { }; qtspim = prev.qt5.callPackage ./qtspim.nix { }; + spotifyd = prev.callPackage ./spotifyd.nix { }; } diff --git a/pkgs/spotifyd.nix b/pkgs/spotifyd.nix new file mode 100644 index 0000000..702a58e --- /dev/null +++ b/pkgs/spotifyd.nix @@ -0,0 +1,49 @@ +{ lib, fetchFromGitHub, rustPackages_1_45, pkg-config, openssl +, withALSA ? true, alsaLib ? null +, withPulseAudio ? false, libpulseaudio ? null +, withPortAudio ? false, portaudio ? null +, withMpris ? false +, withKeyring ? false +, dbus ? null +}: + +# rust >= 1.48 causes a panic within spotifyd on music playback. as long as +# there is no upstream fix for the issue we use an older version of rust. +# Upstream issue: https://github.com/Spotifyd/spotifyd/issues/719 +rustPackages_1_45.rustPlatform.buildRustPackage rec { + pname = "spotifyd"; + version = "0.3.0"; + + src = fetchFromGitHub { + owner = "Spotifyd"; + repo = "spotifyd"; + rev = "v${version}"; + sha256 = "055njhy9if4qpsbgbr6615xxhcx9plava1m4l323vi4dbw09wh5r"; + }; + + cargoSha256 = "1ijrl208607abjwpr3cajcbj6sr35bk6ik778a58zf28kzdhrawc"; + + cargoBuildFlags = [ + "--no-default-features" + "--features" + "${lib.optionalString withALSA "alsa_backend,"}${lib.optionalString withPulseAudio "pulseaudio_backend,"}${lib.optionalString withPortAudio "portaudio_backend,"}${lib.optionalString withMpris "dbus_mpris,"}${lib.optionalString withKeyring "dbus_keyring,"}" + ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] + ++ lib.optional withALSA alsaLib + ++ lib.optional withPulseAudio libpulseaudio + ++ lib.optional withPortAudio portaudio + ++ lib.optional (withMpris || withKeyring) dbus; + + doCheck = false; + + meta = with lib; { + description = "An open source Spotify client running as a UNIX daemon"; + homepage = "https://github.com/Spotifyd/spotifyd"; + license = with licenses; [ gpl3 ]; + maintainers = with maintainers; [ anderslundstedt Br1ght0ne marsam ]; + platforms = platforms.unix; + }; +}