mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat: split spotify config into spotifyd
This commit is contained in:
@@ -136,6 +136,10 @@
|
|||||||
par
|
par
|
||||||
qrencode
|
qrencode
|
||||||
wtf
|
wtf
|
||||||
|
|
||||||
|
spotify
|
||||||
|
spotify-tui
|
||||||
|
playerctl
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
let
|
let
|
||||||
inherit (lib.strings) fileContents;
|
inherit (lib.strings) fileContents;
|
||||||
in {
|
in {
|
||||||
environment.systemPackages = with pkgs; [ spotify spotify-tui playerctl ];
|
services.dbus.packages = [ pkgs.gnome3.dconf ];
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix
|
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix
|
||||||
systemd.user.services.spotifyd = let
|
systemd.user.services.spotifyd = let
|
||||||
spotifyd = pkgs.unstable.spotifyd.override {
|
spotifyd = pkgs.spotifyd.override {
|
||||||
withMpris = true;
|
withMpris = true;
|
||||||
withPulseAudio = true;
|
withPulseAudio = true;
|
||||||
inherit (pkgs) libpulseaudio dbus;
|
inherit (pkgs) libpulseaudio dbus;
|
||||||
@@ -16,20 +16,10 @@ in {
|
|||||||
username = fileContents <secrets/spotify/username>;
|
username = fileContents <secrets/spotify/username>;
|
||||||
password = fileContents <secrets/spotify/password>;
|
password = fileContents <secrets/spotify/password>;
|
||||||
backend = "pulseaudio";
|
backend = "pulseaudio";
|
||||||
on_song_change_hook = toString (pkgs.writers.writeDash "songinfo" ''
|
|
||||||
PATH=$PATH:${
|
|
||||||
lib.makeBinPath [ pkgs.playerctl pkgs.gawk pkgs.libnotify ]
|
|
||||||
}
|
|
||||||
metadata=$(playerctl metadata --player spotifyd)
|
|
||||||
title=$(echo "$metadata" | awk '/^xesam:title\s/ { print substr($0, index($0, $3)) }')
|
|
||||||
artist=$(echo "$metadata" | awk '/^xesam:artist\s/ { print substr($0, index($0, $3)) }' | paste --serial --delimiters "/")
|
|
||||||
album=$(echo "$metadata" | awk '/^xesam:album\s/ { print substr($0, index($0, $3)) }')
|
|
||||||
notify-send --app-name=" Spotify" "$title" "$artist – $album"
|
|
||||||
'');
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
after = [ "network-online.target" "sound.target" ];
|
after = [ "network-online.target" "sound.target" ];
|
||||||
description = "spotifyd, a Spotify playing daemon";
|
description = "spotifyd, a Spotify playing daemon";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Reference in New Issue
Block a user