2020-05-20 00:06:26 +02:00
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
|
let
|
|
|
|
|
inherit (lib.strings) fileContents;
|
2020-06-10 17:37:25 +02:00
|
|
|
in {
|
2020-10-28 20:29:01 +01:00
|
|
|
services.dbus.packages = [ pkgs.gnome3.dconf ];
|
2020-05-20 00:06:26 +02:00
|
|
|
|
2020-05-20 20:45:00 +02:00
|
|
|
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix
|
2020-06-10 17:37:25 +02:00
|
|
|
systemd.user.services.spotifyd = let
|
2020-10-28 20:29:01 +01:00
|
|
|
spotifyd = pkgs.spotifyd.override {
|
2020-05-20 20:45:00 +02:00
|
|
|
withMpris = true;
|
|
|
|
|
withPulseAudio = true;
|
|
|
|
|
inherit (pkgs) libpulseaudio dbus;
|
|
|
|
|
};
|
2020-06-10 17:37:25 +02:00
|
|
|
spotifydConf = pkgs.writeText "spotifyd.conf" (lib.generators.toINI { } {
|
2020-05-20 00:06:26 +02:00
|
|
|
global = {
|
2020-09-24 19:25:47 +02:00
|
|
|
username = fileContents <secrets/spotify/username>;
|
|
|
|
|
password = fileContents <secrets/spotify/password>;
|
2020-05-20 20:45:00 +02:00
|
|
|
backend = "pulseaudio";
|
2020-05-20 00:06:26 +02:00
|
|
|
};
|
2020-05-20 20:45:00 +02:00
|
|
|
});
|
|
|
|
|
in {
|
2020-10-28 20:29:01 +01:00
|
|
|
wantedBy = [ "default.target" ];
|
2020-05-20 20:45:00 +02:00
|
|
|
after = [ "network-online.target" "sound.target" ];
|
|
|
|
|
description = "spotifyd, a Spotify playing daemon";
|
|
|
|
|
serviceConfig = {
|
2020-06-10 17:37:25 +02:00
|
|
|
ExecStart =
|
|
|
|
|
"${spotifyd}/bin/spotifyd --no-daemon --config-path ${spotifydConf}";
|
2020-05-20 20:45:00 +02:00
|
|
|
Restart = "always";
|
|
|
|
|
RestartSec = 12;
|
2020-05-20 00:06:26 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|