summaryrefslogtreecommitdiff
path: root/modules/beets.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
committerAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
commite6ed60548397627bf10f561f9438201dbba0a36e (patch)
treef9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/beets.nix
parent9ac64328603d44bd272175942d3ea3eaadcabd04 (diff)
2024-04-21
Diffstat (limited to 'modules/beets.nix')
-rw-r--r--modules/beets.nix105
1 files changed, 105 insertions, 0 deletions
diff --git a/modules/beets.nix b/modules/beets.nix
new file mode 100644
index 0000000..732f400
--- /dev/null
+++ b/modules/beets.nix
@@ -0,0 +1,105 @@
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib;
+let
+ cfg = config.nixfiles.modules.beets;
+in
+{
+ options.nixfiles.modules.beets.enable = mkEnableOption "beets";
+
+ config = mkIf cfg.enable {
+ hm =
+ let
+ beetsdir = "${config.dirs.data}/beets";
+ in
+ {
+ home = {
+ activation.initialiseBeets = ''
+ if [[ ! -d "${beetsdir}" ]]; then
+ mkdir -p ${beetsdir}
+ fi
+ '';
+
+ sessionVariables.BEETSDIR = beetsdir;
+ };
+
+ programs = {
+ beets = {
+ enable = true;
+
+ package = pkgs.beets-unstable;
+
+ settings = {
+ library = "${beetsdir}/library.db";
+ directory = config.userDirs.music;
+ plugins = concatStringsSep " " [
+ "badfiles"
+ "edit"
+ "fetchart"
+ "info"
+ "mbsync"
+ "mpdupdate"
+ "scrub"
+ "zero"
+ ];
+ original_date = true;
+ import = {
+ write = true;
+ copy = true;
+ move = false;
+ bell = true;
+ from_scratch = true;
+ };
+ match = {
+ preferred = {
+ countries = [
+ "JP"
+ "KR"
+ "TW"
+ "HK"
+ "CN"
+ "RU"
+ "NL"
+ "DE"
+ "AT"
+ "GB|UK"
+ "CA"
+ "AU"
+ "NZ"
+ "US"
+ ];
+ original_year = true;
+ };
+ };
+ edit = {
+ albumfields = "album artist albumartist";
+ itemfields = "track title album artist albumartist day month year genre";
+ };
+ fetchart = {
+ auto = true;
+ cautious = true;
+ cover_names = "cover Cover folder Folder art Art album Album front Front";
+ sources = "filesystem coverart itunes amazon albumart wikipedia";
+ high_resolution = true;
+ };
+ scrub.auto = true;
+ zero = {
+ fields = "comments genre";
+ update_database = true;
+ };
+ mpd = {
+ host = "127.0.0.1";
+ port = 6600;
+ };
+ };
+ };
+
+ bash.shellAliases.beet = "beet --config ${config.dirs.config}/beets/config.yaml";
+ };
+ };
+ };
+}