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