1
0
mirror of https://github.com/kmein/niveum synced 2026-03-21 04:11:07 +01:00
Files
niveum/configs/spotifyd.nix

33 lines
990 B
Nix
Raw Normal View History

2020-05-20 00:06:26 +02:00
{ pkgs, lib, ... }:
let
inherit (lib.strings) fileContents;
2020-06-10 17:37:25 +02:00
in {
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
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 {
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
};
};
}