about summary refs log tree commit diff
path: root/modules/nixos/beets.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
committerAzat Bahawi <azat@bahawi.net>2024-03-31 21:29:27 +0300
commit9a5427e3a0c0ccf2a82dc503149a26b23fbd6004 (patch)
treef28beec29deeea36038615a8fb98a810891940b5 /modules/nixos/beets.nix
parent2024-03-19 (diff)
2024-03-31
Diffstat (limited to '')
-rw-r--r--modules/nixos/beets.nix167
1 files changed, 85 insertions, 82 deletions
diff --git a/modules/nixos/beets.nix b/modules/nixos/beets.nix
index f01e412..732f400 100644
--- a/modules/nixos/beets.nix
+++ b/modules/nixos/beets.nix
@@ -4,99 +4,102 @@
   pkgs,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.beets;
-in {
-  options.nixfiles.modules.beets.enable =
-    mkEnableOption "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
-        '';
+    hm =
+      let
+        beetsdir = "${config.dirs.data}/beets";
+      in
+      {
+        home = {
+          activation.initialiseBeets = ''
+            if [[ ! -d "${beetsdir}" ]]; then
+              mkdir -p ${beetsdir}
+            fi
+          '';
 
-        sessionVariables.BEETSDIR = beetsdir;
-      };
+          sessionVariables.BEETSDIR = beetsdir;
+        };
 
-      programs = {
-        beets = {
-          enable = true;
+        programs = {
+          beets = {
+            enable = true;
 
-          package = pkgs.beets-unstable;
+            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;
+            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;
               };
-            };
-            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";
+          bash.shellAliases.beet = "beet --config ${config.dirs.config}/beets/config.yaml";
+        };
       };
-    };
   };
 }

Consider giving Nix/NixOS a try! <3