beets: minor fixes

This commit is contained in:
Robert Helgesson 2023-05-12 23:25:49 +02:00
parent 8345a3166d
commit caa47705f7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -51,19 +51,22 @@ in {
mpdIntegration = {
enableStats = mkEnableOption "mpdstats plugin and service";
enableUpdate = mkEnableOption "mpdupdate plugin";
host = mkOption {
type = types.str;
default = "localhost";
description = "Host mpdstats will connect to";
example = "10.0.0.42";
description = "The host that mpdstats will connect to.";
};
port = mkOption {
type = types.port;
default = config.services.mpd.network.port;
defaultText = literalExpression "config.services.mpd.network.port";
description = "Port mpdstats will connect to";
example = 6601;
description = "The port that mpdstats will connect to.";
};
};
};
@ -76,18 +79,22 @@ in {
xdg.configFile."beets/config.yaml".source =
yamlFormat.generate "beets-config" cfg.settings;
})
(mkIf (cfg.mpdIntegration.enableStats || cfg.mpdIntegration.enableUpdate) {
programs.beets.settings.mpd = {
host = cfg.mpdIntegration.host;
port = cfg.mpdIntegration.port;
};
})
(mkIf cfg.mpdIntegration.enableStats {
programs.beets.settings.plugins = [ "mpdstats" ];
})
(mkIf cfg.mpdIntegration.enableUpdate {
programs.beets.settings.plugins = [ "mpdupdate" ];
})
(mkIf (cfg.enable && cfg.mpdIntegration.enableStats) {
systemd.user.services."beets-mpdstats" = {
Unit = {