1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-09 18:41:06 +01:00

spotifyd: add module

This commit is contained in:
Kloenk 2019-10-18 21:04:08 +02:00 committed by Robert Helgesson
parent b1dd373f5a
commit eee6ae33e8
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.spotifyd;
configFile = pkgs.writeText "spotifyd.conf" ''
${generators.toINI {} cfg.settings}
'';
in
{
options.services.spotifyd = {
enable = mkEnableOption "SpotifyD connect";
settings = mkOption {
type = types.attrsOf (types.attrsOf types.str);
default = {};
description = "Configuration for spotifyd";
example = literalExample ''
{
global = {
user = "Alex";
password = "foo";
device_name = "nix";
};
}
'';
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.spotifyd ];
systemd.user.services.spotifyd = {
Unit = {
Description = "spotify daemon";
Documentation = "https://github.com/Spotifyd/spotifyd";
};
Install.WantedBy = [ "default.target" ];
Service = {
ExecStart = "${pkgs.spotifyd}/bin/spotifyd --no-daemon --config ${configFile}";
Restart = "always";
RestartSec = 12;
};
};
};
}