From caa47705f791b43feb63f612f2fd13d08275675c Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 12 May 2023 23:25:49 +0200 Subject: [PATCH] beets: minor fixes --- modules/programs/beets.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/programs/beets.nix b/modules/programs/beets.nix index f8399a483..6cadcf9ce 100644 --- a/modules/programs/beets.nix +++ b/modules/programs/beets.nix @@ -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 = {