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

33 lines
990 B
Nix

{ pkgs, lib, ... }:
let
inherit (lib.strings) fileContents;
in {
services.dbus.packages = [ pkgs.gnome3.dconf ];
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/audio/spotifyd.nix
systemd.user.services.spotifyd = let
spotifyd = pkgs.spotifyd.override {
withMpris = true;
withPulseAudio = true;
inherit (pkgs) libpulseaudio dbus;
};
spotifydConf = pkgs.writeText "spotifyd.conf" (lib.generators.toINI { } {
global = {
username = fileContents <secrets/spotify/username>;
password = fileContents <secrets/spotify/password>;
backend = "pulseaudio";
};
});
in {
wantedBy = [ "default.target" ];
after = [ "network-online.target" "sound.target" ];
description = "spotifyd, a Spotify playing daemon";
serviceConfig = {
ExecStart =
"${spotifyd}/bin/spotifyd --no-daemon --config-path ${spotifydConf}";
Restart = "always";
RestartSec = 12;
};
};
}