{ pkgs, lib, config, ... }: let plugins = import ./plugins.nix {}; in { imports = [ ./plugins ]; programs.beets = { enable = true; package = pkgs.beets.override { pluginOverrides = { xtractor = { enable = true; propagatedBuildInputs = [pkgs.beetsExtraPlugins.xtractor]; }; }; }; settings = { library = "${config.xdg.dataHome}/beets/library.db"; art_filename = "cover"; directory = "${config.xdg.userDirs.music}/beets"; ui = { color = true; }; include = [ "./replace_override.yaml" ]; import = { # move, instead of copying or linking the files copy = false; move = true; link = false; # Show more detail, when beet needs to ask for something detail = true; incremental = false; # Write the metadata to the files write = true; log = "${config.xdg.dataHome}/beets/beetslog.txt"; }; paths = let j = lib.strings.concatStringsSep "/"; in { default = j ["[Default]" "$genre" "$first_artist" "$album ($albumtype)" "$track $title"]; "albumtype:live" = j ["[Live]" "$genre" "$first_artist" "$album ($albumtype)" "$track $title"]; "albumtype:album" = j ["Music" "$genre" "$first_artist" "$album ($albumtype)" "$track $title"]; "albumtype::(Single|EP)" = j ["Music" "$genre" "$first_artist_singleton" "$album ($albumtype)" "$track $title"]; "albumtype:compilation" = j ["Complilations" "$genre" "Various Artists" "$album ($albumtype)" "$track $title"]; "albumtype:soundtrack" = j ["Soundtracks" "$genre" "$first_artist" "$album" "$track $title"]; }; inherit plugins; # Plugin config # scrub = { # auto = true; # }; musicbrainz = { # Search for deezer id's and use them in the autotagger # external_ids = { # deezer = true; # }; }; # Log-on config # TODO: Add this, to upload the generated fingerprints (to help improve their # database) <2024-08-07> # acoustid = { # apikey = "TODO"; # }; }; mpdIntegration = { enableStats = true; enableUpdate = true; host = config.home.sessionVariables.MPD_HOST; }; }; xdg.configFile."beets/replace_override.yaml".source = ./replace_override.yaml; # Use the json formatter instead of the YAML one, as the YAML formatter mangles the # longer python inline strings. # YAML is a superset of JSON. xdg.configFile."beets/config.yaml".source = lib.mkForce ((pkgs.formats.json {}).generate "beets-config" config.programs.beets.settings); }