2017-01-07 18:16:26 +00:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
cfg = config.programs.beets;
|
|
|
|
|
|
2020-11-30 02:54:55 +00:00
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
|
in {
|
2017-09-26 21:40:31 +00:00
|
|
|
|
meta.maintainers = [ maintainers.rycee ];
|
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
|
options = {
|
|
|
|
|
programs.beets = {
|
2018-12-04 22:00:11 +00:00
|
|
|
|
enable = mkOption {
|
|
|
|
|
type = types.bool;
|
2020-02-01 23:39:17 +00:00
|
|
|
|
default = if versionAtLeast config.home.stateVersion "19.03" then
|
|
|
|
|
false
|
|
|
|
|
else
|
|
|
|
|
cfg.settings != { };
|
2018-12-04 22:00:11 +00:00
|
|
|
|
defaultText = "false";
|
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable the beets music library manager. This
|
|
|
|
|
defaults to <literal>false</literal> for state
|
|
|
|
|
version ≥ 19.03. For earlier versions beets is enabled if
|
|
|
|
|
<option>programs.beets.settings</option> is non-empty.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-18 00:25:52 +00:00
|
|
|
|
package = mkOption {
|
|
|
|
|
type = types.package;
|
|
|
|
|
default = pkgs.beets;
|
2021-10-09 09:14:08 +00:00
|
|
|
|
defaultText = literalExpression "pkgs.beets";
|
2020-02-01 23:39:17 +00:00
|
|
|
|
example =
|
2021-10-09 09:14:08 +00:00
|
|
|
|
literalExpression "(pkgs.beets.override { enableCheck = true; })";
|
2019-12-18 00:25:52 +00:00
|
|
|
|
description = ''
|
|
|
|
|
The <literal>beets</literal> package to use.
|
|
|
|
|
Can be used to specify extensions.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2017-01-07 18:16:26 +00:00
|
|
|
|
settings = mkOption {
|
2020-11-30 02:54:55 +00:00
|
|
|
|
type = yamlFormat.type;
|
2020-02-01 23:39:17 +00:00
|
|
|
|
default = { };
|
2017-01-15 19:03:55 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Configuration written to
|
2021-12-09 03:02:00 +00:00
|
|
|
|
<filename>$XDG_CONFIG_HOME/beets/config.yaml</filename>
|
2017-01-15 19:03:55 +00:00
|
|
|
|
'';
|
2017-01-07 18:16:26 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2018-12-04 22:00:11 +00:00
|
|
|
|
config = mkIf cfg.enable {
|
2019-12-18 00:25:52 +00:00
|
|
|
|
home.packages = [ cfg.package ];
|
2017-01-07 18:16:26 +00:00
|
|
|
|
|
2020-11-30 02:54:55 +00:00
|
|
|
|
xdg.configFile."beets/config.yaml".source =
|
|
|
|
|
yamlFormat.generate "beets-config" cfg.settings;
|
2017-01-07 18:16:26 +00:00
|
|
|
|
};
|
|
|
|
|
}
|