diff --git a/modules/beets/check.nix b/modules/beets/check.nix
new file mode 100644
index 0000000..e05ffd3
--- /dev/null
+++ b/modules/beets/check.nix
@@ -0,0 +1,31 @@
+{
+ pkgs,
+ self,
+}:
+
+let
+ beetsWrapped =
+ (self.wrapperModules.beets.apply {
+ inherit pkgs;
+
+ settings = {
+ directory = "/tmp/beets-music";
+ library = "/tmp/beets-library.db";
+ plugins = [
+ "musicbrainz"
+ "alternatives"
+ ];
+ };
+
+ extraPlugins.alternatives = pkgs.python3Packages.beets-alternatives;
+ }).wrapper;
+in
+pkgs.runCommand "beets-test" { } ''
+ export HOME=$(mktemp -d)
+
+ "${beetsWrapped}/bin/beet" version | grep \
+ -e "beets version ${beetsWrapped.version}" \
+ -e "plugins: alternatives, musicbrainz"
+
+ touch $out
+''
diff --git a/modules/beets/module.nix b/modules/beets/module.nix
new file mode 100644
index 0000000..b5aff59
--- /dev/null
+++ b/modules/beets/module.nix
@@ -0,0 +1,82 @@
+{
+ config,
+ lib,
+ wlib,
+ ...
+}:
+let
+ yamlFmt = config.pkgs.formats.yaml { };
+in
+{
+ _class = "wrapper";
+
+ options = {
+ basePackage = lib.mkPackageOption config.pkgs.python3Packages "beets" {
+ example = lib.literalExpression ''
+ pkgs.python3Packages.beets.override {
+ pluginOverrides = {
+ beatport.enable = false;
+ };
+ }
+ '';
+ };
+
+ settings = lib.mkOption {
+ inherit (yamlFmt) type;
+ default = { };
+ description = ''
+ See
+ '';
+ example = {
+ directory = "/music";
+ library = "/music/library.db";
+ plugins = [
+ "chroma"
+ "fetchart"
+ ];
+ };
+ };
+
+ configFile = lib.mkOption {
+ type = wlib.types.file config.pkgs;
+ default.path = yamlFmt.generate "beets-config" config.settings;
+ description = ''
+ Configuration of beets
+ '';
+ };
+
+ extraPlugins = lib.mkOption {
+ type = lib.types.attrsOf lib.types.package;
+ default = { };
+ description = ''
+ Attrset mapping beets plugin names to the corresponding package.
+
+ Plugins must be manually enabled in the configuration,
+ see
+ '';
+ example = lib.literalExpression ''
+ {
+ alternatives = pkgs.python3Packages.beets-alternatives;
+ }
+ '';
+ };
+ };
+
+ config = {
+ package = config.basePackage.override (
+ lib.optionalAttrs (config.extraPlugins != { }) {
+ pluginOverrides = lib.mapAttrs (_: pkg: {
+ enable = true;
+ propagatedBuildInputs = [ pkg ];
+ }) config.extraPlugins;
+ }
+ );
+
+ flags."--config" = config.configFile.path;
+
+ meta = {
+ maintainers = [ lib.maintainers.bandithedoge ];
+ platforms = with lib.platforms; linux ++ darwin;
+ };
+ };
+}