Sets up beets with my preferred defaults. Configures the program for the following plugins: - embedart - fetchart - ftintitle - info - lyrics - the
52 lines
1.5 KiB
Nix
52 lines
1.5 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
options.beets = {
|
|
enable = lib.mkEnableOption "Enables beets music";
|
|
plugins = {
|
|
the.enable = lib.mkOption { default = true; };
|
|
ftintitle.enable = lib.mkOption { default = true; };
|
|
lyrics.enable = lib.mkOption { default = true; };
|
|
fetchart = {
|
|
enable = lib.mkOption { default = true; };
|
|
embed = lib.mkOption { default = true; };
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.beets.enable {
|
|
programs.beets.enable = true;
|
|
|
|
programs.beets.settings = {
|
|
directory = "${config.xdg.userDirs.music}";
|
|
library = "${config.xdg.userDirs.music}.db";
|
|
|
|
paths.default = with config.beets.plugins; let
|
|
# raw_artist = if ftintitle.enable
|
|
# then "$album_artist_no_feat"
|
|
# else "$albumartist";
|
|
raw_artist = "$albumartist";
|
|
artist = if the.enable
|
|
then "%the{${raw_artist}}/"
|
|
else raw_artist;
|
|
|
|
the_rest = "$album%aunique{}/$track $title";
|
|
in artist + the_rest;
|
|
|
|
embedart = with config.beets.plugins.fetchart;
|
|
lib.mkIf (enable && embed) {
|
|
maxwidth = 500;
|
|
};
|
|
|
|
plugins = with lib; with config.beets.plugins;
|
|
optional (the.enable) "the" ++
|
|
optional (ftintitle.enable) "ftintitle" ++
|
|
optional (lyrics.enable) "lyrics" ++
|
|
optional (fetchart.enable) "fetchart" ++
|
|
optional (fetchart.embed) "embedart" ++ [
|
|
"musicbrainz"
|
|
"info"
|
|
];
|
|
};
|
|
};
|
|
}
|