From abe9d26a7982e7b77078d4a87453c89b1f579c9a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 4 Dec 2019 00:10:51 -0500 Subject: [PATCH] Add spotify module; use spotifyd --- config/sxhkd/sxhkdrc | 6 +++--- configuration.kuro.nix | 1 + configuration.shiro.nix | 1 + modules/audio/spotify.nix | 24 ++++++++++++++++++++++++ modules/desktop/default.nix | 1 - 5 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 modules/audio/spotify.nix diff --git a/config/sxhkd/sxhkdrc b/config/sxhkd/sxhkdrc index 35296078..4a8ee9c3 100644 --- a/config/sxhkd/sxhkdrc +++ b/config/sxhkd/sxhkdrc @@ -75,11 +75,11 @@ XF86AudioRaiseVolume amixer -q set Master 10%+ unmute XF86Audio{Play,Pause} - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause XF86AudioNext - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next XF86AudioPrev - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotifyd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous # X86Search diff --git a/configuration.kuro.nix b/configuration.kuro.nix index f0c31091..ab7ca68e 100644 --- a/configuration.kuro.nix +++ b/configuration.kuro.nix @@ -10,6 +10,7 @@ ./modules/audio/audacity.nix ./modules/audio/lmms.nix + ./modules/audio/spotify.nix ./modules/browser/firefox.nix ./modules/dev ./modules/editors/emacs.nix diff --git a/configuration.shiro.nix b/configuration.shiro.nix index 59a9d278..735eec4d 100644 --- a/configuration.shiro.nix +++ b/configuration.shiro.nix @@ -12,6 +12,7 @@ in { ./modules/desktop/bspwm.nix + ./modules/audio/spotify.nix ./modules/browser/firefox.nix ./modules/dev ./modules/graphics/aseprite.nix diff --git a/modules/audio/spotify.nix b/modules/audio/spotify.nix new file mode 100644 index 00000000..df213b63 --- /dev/null +++ b/modules/audio/spotify.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +let unstable = import {}; +in +{ + environment.systemPackages = with pkgs; [ + # services.spotifyd doesn't work so... + spotifyd + (writeScriptBin "spt" '' + #!${stdenv.shell} + if ! pgrep -x spotifyd >/dev/null; then + spotifyd --backend pulseaudio \ + --cache_path ~/.cache/spotifyd \ + --username accounts@v0.io \ + --password $(pass www/spotify.com) + fi + ${unstable.spotify-tui}/bin/spt + '') + + # spotify-tui is fine for selecting and playing music, but incomplete. We + # occasionally still need the official client. + spotify + ]; +} diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 5deb74bc..2a68269c 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -14,7 +14,6 @@ # Useful apps evince # pdf reader (callPackage {}) - spotify ]; sound.enable = true;