1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-09-29 17:57:28 +02:00
home-manager/modules/programs/beets.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

110 lines
3.1 KiB
Nix
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.beets;
yamlFormat = pkgs.formats.yaml { };
in {
meta.maintainers = with maintainers; [ rycee Scrumplex ];
options = {
programs.beets = {
enable = mkOption {
type = types.bool;
default = if versionAtLeast config.home.stateVersion "19.03" then
false
else
cfg.settings != { };
defaultText = "false";
description = lib.mdDoc ''
Whether to enable the beets music library manager. This
defaults to `false` for state
version  19.03. For earlier versions beets is enabled if
{option}`programs.beets.settings` is non-empty.
'';
};
package = mkOption {
type = types.package;
default = pkgs.beets;
defaultText = literalExpression "pkgs.beets";
example =
literalExpression "(pkgs.beets.override { enableCheck = true; })";
description = lib.mdDoc ''
The `beets` package to use.
Can be used to specify extensions.
'';
};
settings = mkOption {
type = yamlFormat.type;
default = { };
description = lib.mdDoc ''
Configuration written to
{file}`$XDG_CONFIG_HOME/beets/config.yaml`
'';
};
mpdIntegration = {
enableStats = mkEnableOption (lib.mdDoc "mpdstats plugin and service");
enableUpdate = mkEnableOption (lib.mdDoc "mpdupdate plugin");
host = mkOption {
type = types.str;
default = "localhost";
example = "10.0.0.42";
description = lib.mdDoc "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";
example = 6601;
description = lib.mdDoc "The port that mpdstats will connect to.";
};
};
};
};
config = mkMerge [
(mkIf cfg.enable {
home.packages = [ cfg.package ];
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 = {
Description = "Beets MPDStats daemon";
After = optional config.services.mpd.enable "mpd.service";
Requires = optional config.services.mpd.enable "mpd.service";
};
Service.ExecStart = "${cfg.package}/bin/beet mpdstats";
Install.WantedBy = [ "default.target" ];
};
})
];
}