nix-dotfiles/hmModules/apps/beets/app.nix

53 lines
1.5 KiB
Nix
Raw Permalink Normal View History

{ 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"
];
};
};
}