From 09ae6daec055163b6219a1ec2dc0b4f69e5f2cba Mon Sep 17 00:00:00 2001 From: Julia Lange Date: Tue, 10 Feb 2026 09:50:06 -0800 Subject: [PATCH] Beets, initial commit Sets up beets with my preferred defaults. Configures the program for the following plugins: - embedart - fetchart - ftintitle - info - lyrics - the --- hmModules/apps/beets/app.nix | 52 ++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 hmModules/apps/beets/app.nix diff --git a/hmModules/apps/beets/app.nix b/hmModules/apps/beets/app.nix new file mode 100644 index 0000000..cb983ec --- /dev/null +++ b/hmModules/apps/beets/app.nix @@ -0,0 +1,52 @@ +{ 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" + ]; + }; + }; +}