Add spotify module; use spotifyd

This commit is contained in:
Henrik Lissner 2019-12-04 00:10:51 -05:00
parent c897191831
commit abe9d26a79
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 29 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -12,6 +12,7 @@ in {
./modules/desktop/bspwm.nix
./modules/audio/spotify.nix
./modules/browser/firefox.nix
./modules/dev
./modules/graphics/aseprite.nix

24
modules/audio/spotify.nix Normal file
View file

@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
let unstable = import <nixpkgs-unstable> {};
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
];
}

View file

@ -14,7 +14,6 @@
# Useful apps
evince # pdf reader
(callPackage <packages/ripcord.nix> {})
spotify
];
sound.enable = true;