nixos/modules/common/applications/spotifyd.nix
2024-08-25 20:31:21 -04:00

53 lines
1.4 KiB
Nix

{ config, pkgs, lib, ... }:
{
options = {
spotifyd = {
enable = lib.mkEnableOption {
description = "Enable spotifyd";
default = false;
};
};
};
config = lib.mkIf (config.spotifyd.enable) {
home-manager.users.${config.user} = {
home.packages = [
pkgs.spotifyd
];
};
sops = {
secrets."spotifyd/settings/global/password" = { };
templates = {
"spotifyd.conf" = {
owner = "annika";
content = ''
[global]
# username = "me@annikamerris.com"
username = "317omerbg5kalklxwpenedfcnrcq"
# password = "${config.sops.placeholder."spotifyd/settings/global/password"}"
cache_directory = "/home/annika/.cache/spotifyd"
use_mpris = true
device_name = "kim-nix"
device_type = "computer"
'';
};
};
};
# Install and setup spotifyd
# sops.templates.
systemd.user.services.spotifyd = {
description = "spotify daemon";
documentation = [ "https://github.com/Spotifyd/spotifyd" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart =
"${pkgs.spotifyd}/bin/spotifyd --no-daemon --config-path ${config.sops.templates."spotifyd.conf".path}";
Restart = "always";
RestartSec = 12;
};
};
};
}