diff --git a/pkgs/by-name/be/beets-minimal/package.nix b/pkgs/by-name/be/beets-minimal/package.nix new file mode 100644 index 000000000000..de0125445743 --- /dev/null +++ b/pkgs/by-name/be/beets-minimal/package.nix @@ -0,0 +1,5 @@ +{ + python3, +}: + +python3.pkgs.toPythonApplication python3.pkgs.beets-minimal diff --git a/pkgs/by-name/be/beets/package.nix b/pkgs/by-name/be/beets/package.nix new file mode 100644 index 000000000000..0d8837e0c0d8 --- /dev/null +++ b/pkgs/by-name/be/beets/package.nix @@ -0,0 +1,5 @@ +{ + python3, +}: + +python3.pkgs.toPythonApplication python3.pkgs.beets diff --git a/pkgs/development/python-modules/beets-alternatives/default.nix b/pkgs/development/python-modules/beets-alternatives/default.nix new file mode 100644 index 000000000000..29051861646a --- /dev/null +++ b/pkgs/development/python-modules/beets-alternatives/default.nix @@ -0,0 +1,74 @@ +{ + lib, + fetchFromGitHub, + fetchpatch, + buildPythonPackage, + + # build-system + poetry-core, + + # nativeBuildInputs + beets-minimal, + + # tests + pytestCheckHook, + pytest-cov-stub, + mock, + pillow, + tomli, + typeguard, + writableTmpDirAsHomeHook, +}: + +buildPythonPackage rec { + pname = "beets-alternatives"; + version = "0.13.4"; + pyproject = true; + + src = fetchFromGitHub { + repo = "beets-alternatives"; + owner = "geigerzaehler"; + tag = "v${version}"; + hash = "sha256-jGHRoBBXqJq0r/Gbp7gkuaEFPVMGE6cqQRi84AHTXxQ="; + }; + + patches = [ + # Fixes build failure by ignoring DeprecationWarning during tests. + (fetchpatch { + url = "https://github.com/geigerzaehler/beets-alternatives/commit/3c15515edfe62d5d6c8f3fb729bf3dcef41c1ffa.patch"; + hash = "sha256-gZXftDI5PXJ0c65Z1HLABJ2SlDnXU78xxIEt7IGp8RQ="; + excludes = [ + "poetry.lock" + ]; + }) + ]; + + build-system = [ + poetry-core + ]; + + nativeBuildInputs = [ + beets-minimal + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-cov-stub + mock + pillow + tomli + typeguard + writableTmpDirAsHomeHook + ]; + + meta = { + description = "Beets plugin to manage external files"; + homepage = "https://github.com/geigerzaehler/beets-alternatives"; + changelog = "https://github.com/geigerzaehler/beets-alternatives/blob/v${version}/CHANGELOG.md"; + maintainers = with lib.maintainers; [ + aszlig + lovesegfault + ]; + license = lib.licenses.mit; + }; +} diff --git a/pkgs/tools/audio/beets/plugins/audible.nix b/pkgs/development/python-modules/beets-audible/default.nix similarity index 80% rename from pkgs/tools/audio/beets/plugins/audible.nix rename to pkgs/development/python-modules/beets-audible/default.nix index 9bc10074d2f2..39b265ac7235 100644 --- a/pkgs/tools/audio/beets/plugins/audible.nix +++ b/pkgs/development/python-modules/beets-audible/default.nix @@ -1,11 +1,24 @@ { - beets, - fetchFromGitHub, lib, + fetchFromGitHub, + buildPythonPackage, + + # build-system + hatchling, + + # native + beets, + + # dependencies + markdownify, + natsort, + tldextract, + + # passthru nix-update-script, - python3Packages, }: -python3Packages.buildPythonApplication rec { + +buildPythonPackage rec { pname = "beets-audible"; version = "1.0.2"; pyproject = true; @@ -17,17 +30,17 @@ python3Packages.buildPythonApplication rec { hash = "sha256-6rf8U63SW+gwfT7ZdN/ymYKHRs0HSMDTP2ZBfULLsJs="; }; + build-system = [ + hatchling + ]; + nativeBuildInputs = [ beets ]; pythonRelaxDeps = true; - build-system = with python3Packages; [ - hatchling - ]; - - dependencies = with python3Packages; [ + dependencies = [ markdownify natsort tldextract diff --git a/pkgs/tools/audio/beets/plugins/copyartifacts.nix b/pkgs/development/python-modules/beets-copyartifacts/default.nix similarity index 80% rename from pkgs/tools/audio/beets/plugins/copyartifacts.nix rename to pkgs/development/python-modules/beets-copyartifacts/default.nix index 49bc0dadf797..ed7ab0ba8cfe 100644 --- a/pkgs/tools/audio/beets/plugins/copyartifacts.nix +++ b/pkgs/development/python-modules/beets-copyartifacts/default.nix @@ -1,12 +1,23 @@ { lib, - beets, fetchFromGitHub, - python3Packages, + buildPythonPackage, + + # build-system + setuptools, + + # nativeBuildInputs + beets-minimal, + + # dependencies + six, + + # tests + pytestCheckHook, writableTmpDirAsHomeHook, }: -python3Packages.buildPythonApplication rec { +buildPythonPackage rec { pname = "beets-copyartifacts"; version = "0.1.5"; pyproject = true; @@ -27,20 +38,20 @@ python3Packages.buildPythonApplication rec { sed -i -e 's/util\.py3_path/os.fsdecode/g' tests/_common.py ''; - nativeBuildInputs = [ - beets - ]; - - build-system = with python3Packages; [ + build-system = [ setuptools ]; - dependencies = with python3Packages; [ + nativeBuildInputs = [ + beets-minimal + ]; + + dependencies = [ six ]; nativeCheckInputs = [ - python3Packages.pytestCheckHook + pytestCheckHook writableTmpDirAsHomeHook ]; @@ -55,7 +66,7 @@ python3Packages.buildPythonApplication rec { homepage = "https://github.com/adammillerio/beets-copyartifacts"; changelog = "https://github.com/adammillerio/beets-copyartifacts/releases/tag/${src.tag}"; license = lib.licenses.mit; - inherit (beets.meta) platforms; + inherit (beets-minimal.meta) platforms; # Isn't compatible with beets >= 2.3 broken = true; }; diff --git a/pkgs/tools/audio/beets/plugins/filetote.nix b/pkgs/development/python-modules/beets-filetote/default.nix similarity index 55% rename from pkgs/tools/audio/beets/plugins/filetote.nix rename to pkgs/development/python-modules/beets-filetote/default.nix index d397658bd8da..9b12b86118de 100644 --- a/pkgs/tools/audio/beets/plugins/filetote.nix +++ b/pkgs/development/python-modules/beets-filetote/default.nix @@ -1,13 +1,26 @@ { lib, fetchFromGitHub, - python3Packages, - beets, - beetsPackages, + buildPythonPackage, + + # build-system + poetry-core, + + # nativeBuildInputs + beets-minimal, + + # tests + pytestCheckHook, + beets-audible, + mediafile, + pytest, + reflink, + toml, + typeguard, writableTmpDirAsHomeHook, }: -python3Packages.buildPythonApplication rec { +buildPythonPackage rec { pname = "beets-filetote"; version = "1.1.0"; pyproject = true; @@ -23,41 +36,30 @@ python3Packages.buildPythonApplication rec { substituteInPlace pyproject.toml --replace-fail "poetry-core<2.0.0" "poetry-core" ''; - nativeBuildInputs = [ - beets + build-system = [ + poetry-core ]; - build-system = [ python3Packages.poetry-core ]; + nativeBuildInputs = [ + beets-minimal + ]; - dependencies = with python3Packages; [ + dependencies = [ mediafile reflink toml typeguard ]; - optional-dependencies = { - lint = with python3Packages; [ - black - check-manifest - flake8 - flake8-bugbear - flake8-bugbear-pyi - isort - mypy - pylint - typing_extensions - ]; - test = with python3Packages; [ - beetsPackages.audible - mediafile - pytest - reflink - toml - typeguard - ]; - dev = optional-dependencies.lint ++ optional-dependencies.test ++ [ python3Packages.tox ]; - }; + nativeCheckInputs = [ + pytestCheckHook + beets-audible + mediafile + reflink + toml + typeguard + writableTmpDirAsHomeHook + ]; pytestFlags = [ # This is the same as: @@ -71,19 +73,13 @@ python3Packages.buildPythonApplication rec { "tests/test_version.py" ]; - nativeCheckInputs = [ - python3Packages.pytestCheckHook - writableTmpDirAsHomeHook - ] - ++ optional-dependencies.test; - - meta = with lib; { + meta = { description = "Beets plugin to move non-music files during the import process"; homepage = "https://github.com/gtronset/beets-filetote"; changelog = "https://github.com/gtronset/beets-filetote/blob/${src.tag}/CHANGELOG.md"; - maintainers = with maintainers; [ dansbandit ]; - license = licenses.mit; - inherit (beets.meta) platforms; + maintainers = with lib.maintainers; [ dansbandit ]; + license = lib.licenses.mit; + inherit (beets-minimal.meta) platforms; # https://github.com/gtronset/beets-filetote/issues/211 broken = true; }; diff --git a/pkgs/tools/audio/beets/patches/bash-completion-always-print.patch b/pkgs/development/python-modules/beets/bash-completion-always-print.patch similarity index 100% rename from pkgs/tools/audio/beets/patches/bash-completion-always-print.patch rename to pkgs/development/python-modules/beets/bash-completion-always-print.patch diff --git a/pkgs/development/python-modules/beets/default.nix b/pkgs/development/python-modules/beets/default.nix new file mode 100644 index 000000000000..bb6a8822fa56 --- /dev/null +++ b/pkgs/development/python-modules/beets/default.nix @@ -0,0 +1,495 @@ +/* + ** To customize the enabled beets plugins, use the pluginOverrides input to the + ** derivation. + ** Examples: + ** + ** Disabling a builtin plugin: + ** python3.pkgs.beets.override { + ** pluginOverrides = { + ** beatport.enable = false; + ** }; + ** } + ** + ** Enabling an external plugin: + ** python3.pkgs.beets.override { + ** pluginOverrides = { + ** alternatives = { + ** enable = true; + ** propagatedBuildInputs = [ beets-alternatives ]; + ** }; + ** }; + ** } +*/ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + beets, + + # build-system + poetry-core, + poetry-dynamic-versioning, + + # dependencies + confuse, + gst-python, + jellyfish, + mediafile, + munkres, + musicbrainzngs, + platformdirs, + pyyaml, + unidecode, + reflink, + typing-extensions, + lap, + + # native + gobject-introspection, + sphinxHook, + sphinx-design, + sphinx-copybutton, + pydata-sphinx-theme, + + # buildInputs + gst_all_1, + + # plugin deps + aacgain, + beautifulsoup4, + chromaprint, + discogs-client, + ffmpeg, + flac, + flask, + flask-cors, + imagemagick, + keyfinder-cli, + langdetect, + librosa, + mp3gain, + mp3val, + mpd2, + pyacoustid, + pylast, + pyxdg, + requests, + requests-oauthlib, + resampy, + soco, + + # configurations + extraPatches ? [ ], + pluginOverrides ? { }, + disableAllPlugins ? false, + extraDisabledTests ? [ ], + extraNativeBuildInputs ? [ ], + + # tests + pytestCheckHook, + pytest-cov-stub, + mock, + rarfile, + responses, + requests-mock, + pillow, + writableTmpDirAsHomeHook, + + # preCheck + bashInteractive, + diffPlugins, + runtimeShell, + writeScript, + + # passthru.tests + runCommand, +}: + +buildPythonPackage rec { + pname = "beets"; + version = "2.5.1"; + src = fetchFromGitHub { + owner = "beetbox"; + repo = "beets"; + tag = "v${version}"; + hash = "sha256-H3jcEHyK13+RHVlV4zp+8M3LZ0Jc2FdmAbLpekGozLA="; + }; + pyproject = true; + + patches = [ + # Bash completion fix for Nix + ./bash-completion-always-print.patch + ] + ++ extraPatches; + + build-system = [ + poetry-core + poetry-dynamic-versioning + ]; + + dependencies = [ + confuse + gst-python + jellyfish + mediafile + munkres + musicbrainzngs + platformdirs + pyyaml + unidecode + # Can be built without it, but is useful on btrfs systems, and doesn't + # add too much to the closure. See: + # https://github.com/NixOS/nixpkgs/issues/437308 + reflink + typing-extensions + lap + ] + ++ (lib.concatMap (p: p.propagatedBuildInputs) (lib.attrValues passthru.plugins.enabled)); + + nativeBuildInputs = [ + gobject-introspection + sphinxHook + sphinx-design + sphinx-copybutton + pydata-sphinx-theme + ] + ++ extraNativeBuildInputs; + + buildInputs = with gst_all_1; [ + gst-plugins-base + gst-plugins-good + gst-plugins-ugly + ]; + + outputs = [ + "out" + "doc" + "man" + ]; + sphinxBuilders = [ + "html" + "man" + ]; + # Causes an installManPage error. Not clear why this directory gets generated + # with the manpages. The same directory is observed correctly in + # $doc/share/doc/beets-${version}/html + preInstallSphinx = '' + rm -r .sphinx/man/man/_sphinx_design_static + ''; + + postInstall = '' + mkdir -p $out/share/zsh/site-functions + cp extra/_beet $out/share/zsh/site-functions/ + ''; + + makeWrapperArgs = [ + "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" + "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" + "--prefix PATH : ${lib.makeBinPath passthru.plugins.wrapperBins}" + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-cov-stub + mock + rarfile + responses + requests-mock + pillow + writableTmpDirAsHomeHook + ] + ++ passthru.plugins.wrapperBins; + + __darwinAllowLocalNetworking = true; + + disabledTestPaths = + passthru.plugins.disabledTestPaths + ++ [ + # touches network + "test/plugins/test_aura.py" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Flaky: several tests fail randomly with: + # if not self._poll(timeout): + # raise Empty + # _queue.Empty + "test/plugins/test_bpd.py" + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + # fail on Hydra with `RuntimeError: image cannot be obtained without artresizer backend` + "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio" + "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio_with_percent_margin" + "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio_with_px_margin" + "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_minwidth" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_deinterlaced" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_deinterlaced_and_resized" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_not_resized" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized_and_scaled" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized_but_not_scaled" + "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_resize" + ]; + disabledTests = extraDisabledTests ++ [ + # touches network + "test_merge_duplicate_album" + # The existence of the dependency reflink (see comment above), causes this + # test to be run, and it fails in the sandbox. + "test_successful_reflink" + ]; + + # Perform extra "sanity checks", before running pytest tests. + preCheck = '' + # Check for undefined plugins + find beetsplug -mindepth 1 \ + \! -path 'beetsplug/__init__.py' -a \ + \( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \ + | sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \ + | sort -u > plugins_available + ${diffPlugins (lib.attrNames passthru.plugins.builtins) "plugins_available"} + + export BEETS_TEST_SHELL="${lib.getExe bashInteractive} --norc" + + env EDITOR="${writeScript "beetconfig.sh" '' + #!${runtimeShell} + cat > "$1" < $out/config.yaml + replaygain: + backend: gstreamer + EOF + + ${beets}/bin/beet -c $out/config.yaml > /dev/null + ''; + }; + }; + + meta = { + description = "Music tagger and library organizer"; + homepage = "https://beets.io"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + doronbehar + lovesegfault + montchr + pjones + ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; + mainProgram = "beet"; + }; +} diff --git a/pkgs/development/python-modules/confuse/default.nix b/pkgs/development/python-modules/confuse/default.nix index e713f0166406..79736bac54f1 100644 --- a/pkgs/development/python-modules/confuse/default.nix +++ b/pkgs/development/python-modules/confuse/default.nix @@ -2,15 +2,21 @@ lib, buildPythonPackage, fetchFromGitHub, - flit-core, - pyyaml, - pytestCheckHook, pythonOlder, + + # build-system + flit-core, + + # dependencies + pyyaml, + + # tests + pytestCheckHook, }: buildPythonPackage rec { pname = "confuse"; - version = "1.7.0"; + version = "2.0.1"; format = "pyproject"; disabled = pythonOlder "3.7"; @@ -19,21 +25,30 @@ buildPythonPackage rec { owner = "beetbox"; repo = "confuse"; rev = "v${version}"; - hash = "sha256-zdH5DNXnuAfYTuaG9EIKiXL2EbLSfzYjPSkC3G06bU8="; + hash = "sha256-TVx0cBXv/fIuli/xrFXBAmwJ1rQr5xJL1Q67FaDr4ow="; }; - nativeBuildInputs = [ flit-core ]; + build-system = [ + flit-core + ]; - propagatedBuildInputs = [ pyyaml ]; + dependencies = [ + pyyaml + ]; - nativeCheckInputs = [ pytestCheckHook ]; + nativeCheckInputs = [ + pytestCheckHook + ]; pythonImportsCheck = [ "confuse" ]; - meta = with lib; { + meta = { description = "Python configuration library for Python that uses YAML"; homepage = "https://github.com/beetbox/confuse"; - license = licenses.mit; - maintainers = with maintainers; [ lovesegfault ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + lovesegfault + doronbehar + ]; }; } diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix deleted file mode 100644 index 21b949affbb4..000000000000 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ /dev/null @@ -1,184 +0,0 @@ -{ - aacgain, - chromaprint, - ffmpeg, - flac, - imagemagick, - keyfinder-cli, - mp3gain, - mp3val, - python3Packages, - version, - lib, - ... -}: -{ - absubmit = { - deprecated = true; - testPaths = [ ]; - }; - advancedrewrite = { - testPaths = [ ]; - }; - acousticbrainz = { - deprecated = true; - propagatedBuildInputs = [ python3Packages.requests ]; - }; - albumtypes = { }; - aura = { - propagatedBuildInputs = with python3Packages; [ - flask - flask-cors - pillow - ]; - }; - autobpm = { - propagatedBuildInputs = with python3Packages; [ - librosa - # An optional dependency of librosa, needed for beets' autobpm - resampy - ]; - }; - badfiles = { - testPaths = [ ]; - wrapperBins = [ - mp3val - flac - ]; - }; - bareasc = { }; - beatport.propagatedBuildInputs = [ python3Packages.requests-oauthlib ]; - bench.testPaths = [ ]; - bpd.testPaths = [ ]; - bpm.testPaths = [ ]; - bpsync.testPaths = [ ]; - bucket = { }; - chroma = { - propagatedBuildInputs = [ python3Packages.pyacoustid ]; - testPaths = [ ]; - wrapperBins = [ - chromaprint - ]; - }; - convert.wrapperBins = [ ffmpeg ]; - deezer = { - propagatedBuildInputs = [ python3Packages.requests ]; - testPaths = [ ]; - }; - discogs.propagatedBuildInputs = with python3Packages; [ - discogs-client - requests - ]; - duplicates.testPaths = [ ]; - edit = { }; - embedart = { - propagatedBuildInputs = with python3Packages; [ pillow ]; - wrapperBins = [ imagemagick ]; - }; - embyupdate.propagatedBuildInputs = [ python3Packages.requests ]; - export = { }; - fetchart = { - propagatedBuildInputs = with python3Packages; [ - beautifulsoup4 - langdetect - pillow - requests - ]; - wrapperBins = [ imagemagick ]; - }; - filefilter = { }; - fish.testPaths = [ ]; - freedesktop.testPaths = [ ]; - fromfilename.testPaths = [ ]; - ftintitle = { }; - fuzzy.testPaths = [ ]; - gmusic.testPaths = [ ]; - hook = { }; - ihate = { }; - importadded = { }; - importfeeds = { }; - info = { }; - inline.testPaths = [ ]; - ipfs = { }; - keyfinder.wrapperBins = [ keyfinder-cli ]; - kodiupdate = { - propagatedBuildInputs = [ python3Packages.requests ]; - testPaths = [ ]; - }; - lastgenre.propagatedBuildInputs = [ python3Packages.pylast ]; - lastimport = { - propagatedBuildInputs = [ python3Packages.pylast ]; - testPaths = [ ]; - }; - limit = { }; - listenbrainz = { - testPaths = [ ]; - }; - loadext = { - propagatedBuildInputs = [ python3Packages.requests ]; - testPaths = [ ]; - }; - lyrics.propagatedBuildInputs = with python3Packages; [ - beautifulsoup4 - langdetect - requests - ]; - mbcollection.testPaths = [ ]; - mbsubmit = { }; - mbsync = { }; - metasync.testPaths = [ ]; - missing.testPaths = [ ]; - mpdstats.propagatedBuildInputs = [ python3Packages.mpd2 ]; - mpdupdate = { - propagatedBuildInputs = [ python3Packages.mpd2 ]; - testPaths = [ ]; - }; - musicbrainz = { }; - parentwork = { }; - permissions = { }; - play = { }; - playlist.propagatedBuildInputs = [ python3Packages.requests ]; - plexupdate = { }; - random = { }; - replace = { }; - replaygain.wrapperBins = [ - aacgain - ffmpeg - mp3gain - ]; - rewrite.testPaths = [ ]; - scrub.testPaths = [ ]; - smartplaylist = { }; - sonosupdate = { - propagatedBuildInputs = [ python3Packages.soco ]; - testPaths = [ ]; - }; - spotify = { }; - subsonicplaylist = { - propagatedBuildInputs = [ python3Packages.requests ]; - testPaths = [ ]; - }; - subsonicupdate.propagatedBuildInputs = [ python3Packages.requests ]; - substitute = { - testPaths = [ ]; - }; - the = { }; - thumbnails = { - propagatedBuildInputs = with python3Packages; [ - pillow - pyxdg - ]; - wrapperBins = [ imagemagick ]; - }; - types.testPaths = [ "test/plugins/test_types_plugin.py" ]; - unimported.testPaths = [ ]; - web.propagatedBuildInputs = with python3Packages; [ - flask - flask-cors - ]; - zero = { }; - _typing = { - testPaths = [ ]; - }; - _utils = { }; -} diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix deleted file mode 100644 index 132a8f5aebbe..000000000000 --- a/pkgs/tools/audio/beets/common.nix +++ /dev/null @@ -1,269 +0,0 @@ -{ - lib, - stdenv, - src, - version, - fetchpatch, - bashInteractive, - diffPlugins, - gobject-introspection, - gst_all_1, - python3Packages, - sphinxHook, - writableTmpDirAsHomeHook, - runtimeShell, - writeScript, - - # plugin deps, used indirectly by the @inputs when we `import ./builtin-plugins.nix` - aacgain, - chromaprint, - essentia-extractor, - ffmpeg, - flac, - imagemagick, - keyfinder-cli, - mp3gain, - mp3val, - - extraPatches ? [ ], - pluginOverrides ? { }, - disableAllPlugins ? false, - disabledTests ? [ ], - extraNativeBuildInputs ? [ ], - - # tests - runCommand, - beets, -}@inputs: -let - inherit (lib) attrNames attrValues concatMap; - - mkPlugin = - { - name, - enable ? !disableAllPlugins, - builtin ? false, - propagatedBuildInputs ? [ ], - testPaths ? [ - "test/plugins/test_${name}.py" - ], - wrapperBins ? [ ], - }: - { - inherit - name - enable - builtin - propagatedBuildInputs - testPaths - wrapperBins - ; - }; - - basePlugins = lib.mapAttrs (_: a: { builtin = true; } // a) (import ./builtin-plugins.nix inputs); - pluginOverrides' = lib.mapAttrs ( - plugName: - lib.throwIf (basePlugins.${plugName}.deprecated or false) - "beets evaluation error: Plugin ${plugName} was enabled in pluginOverrides, but it has been removed. Remove the override to fix evaluation." - ) pluginOverrides; - - allPlugins = lib.mapAttrs (n: a: mkPlugin { name = n; } // a) ( - lib.recursiveUpdate basePlugins pluginOverrides' - ); - builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins; - enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins; - disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins; - disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins)); - - pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins); -in -python3Packages.buildPythonApplication { - pname = "beets"; - inherit src version; - pyproject = true; - - patches = [ - ] - ++ extraPatches; - - build-system = [ - python3Packages.poetry-core - python3Packages.poetry-dynamic-versioning - ]; - - dependencies = - with python3Packages; - [ - confuse - gst-python - jellyfish - mediafile - munkres - musicbrainzngs - platformdirs - pyyaml - unidecode - # Can be built without it, but is useful on btrfs systems, and doesn't - # add too much to the closure. See: - # https://github.com/NixOS/nixpkgs/issues/437308 - reflink - typing-extensions - lap - ] - ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins)); - - nativeBuildInputs = [ - gobject-introspection - sphinxHook - python3Packages.pydata-sphinx-theme - python3Packages.sphinx-design - python3Packages.sphinx-copybutton - ] - ++ extraNativeBuildInputs; - - buildInputs = [ - ] - ++ (with gst_all_1; [ - gst-plugins-base - gst-plugins-good - gst-plugins-ugly - ]); - - outputs = [ - "out" - "doc" - "man" - ]; - sphinxBuilders = [ - "html" - "man" - ]; - # Causes an installManPage error. Not clear why this directory gets generated - # with the manpages. The same directory is observed correctly in - # $doc/share/doc/beets-${version}/html - preInstallSphinx = '' - rm -r .sphinx/man/man/_sphinx_design_static - ''; - - postInstall = '' - mkdir -p $out/share/zsh/site-functions - cp extra/_beet $out/share/zsh/site-functions/ - ''; - - makeWrapperArgs = [ - "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" - "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" - "--prefix PATH : ${lib.makeBinPath pluginWrapperBins}" - ]; - - nativeCheckInputs = - with python3Packages; - [ - pytestCheckHook - pytest-cov-stub - mock - rarfile - responses - requests-mock - pillow - ] - ++ [ - writableTmpDirAsHomeHook - ] - ++ pluginWrapperBins; - - __darwinAllowLocalNetworking = true; - - disabledTestPaths = - disabledTestPaths - ++ [ - # touches network - "test/plugins/test_aura.py" - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - # Flaky: several tests fail randomly with: - # if not self._poll(timeout): - # raise Empty - # _queue.Empty - "test/plugins/test_bpd.py" - ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ - # fail on Hydra with `RuntimeError: image cannot be obtained without artresizer backend` - "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio" - "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio_with_percent_margin" - "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_enforce_ratio_with_px_margin" - "test/plugins/test_art.py::AlbumArtOperationConfigurationTest::test_minwidth" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_deinterlaced" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_deinterlaced_and_resized" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_not_resized" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized_and_scaled" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_file_resized_but_not_scaled" - "test/plugins/test_art.py::AlbumArtPerformOperationTest::test_resize" - ]; - disabledTests = disabledTests ++ [ - # https://github.com/beetbox/beets/issues/5880 - "test_reject_different_art" - # touches network - "test_merge_duplicate_album" - # The existence of the dependency reflink (see comment above), causes this - # test to be run, and it fails in the sandbox. - "test_successful_reflink" - ]; - - # Perform extra "sanity checks", before running pytest tests. - preCheck = '' - # Check for undefined plugins - find beetsplug -mindepth 1 \ - \! -path 'beetsplug/__init__.py' -a \ - \( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \ - | sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \ - | sort -u > plugins_available - ${diffPlugins (attrNames builtinPlugins) "plugins_available"} - - export BEETS_TEST_SHELL="${lib.getExe bashInteractive} --norc" - - env EDITOR="${writeScript "beetconfig.sh" '' - #!${runtimeShell} - cat > "$1" < $out/config.yaml - replaygain: - backend: gstreamer - EOF - - ${beets}/bin/beet -c $out/config.yaml > /dev/null - ''; - - meta = { - description = "Music tagger and library organizer"; - homepage = "https://beets.io"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ - aszlig - doronbehar - lovesegfault - montchr - pjones - ]; - platforms = lib.platforms.linux ++ lib.platforms.darwin; - mainProgram = "beet"; - }; -} diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix deleted file mode 100644 index 39a057cd18c8..000000000000 --- a/pkgs/tools/audio/beets/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - lib, - callPackage, - config, - fetchFromGitHub, - python3Packages, -}: -/* - ** To customize the enabled beets plugins, use the pluginOverrides input to the - ** derivation. - ** Examples: - ** - ** Disabling a builtin plugin: - ** beets.override { pluginOverrides = { beatport.enable = false; }; } - ** - ** Enabling an external plugin: - ** beets.override { pluginOverrides = { - ** alternatives = { enable = true; propagatedBuildInputs = [ beetsPackages.alternatives ]; }; - ** }; } -*/ -let - extraPatches = [ - # Bash completion fix for Nix - ./patches/bash-completion-always-print.patch - ]; -in -lib.makeExtensible ( - self: - { - beets = self.beets-stable; - - beets-stable = callPackage ./common.nix rec { - inherit python3Packages extraPatches; - version = "2.5.1"; - src = fetchFromGitHub { - owner = "beetbox"; - repo = "beets"; - tag = "v${version}"; - hash = "sha256-H3jcEHyK13+RHVlV4zp+8M3LZ0Jc2FdmAbLpekGozLA="; - }; - }; - - beets-minimal = self.beets.override { disableAllPlugins = true; }; - - alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; }; - audible = callPackage ./plugins/audible.nix { beets = self.beets-minimal; }; - copyartifacts = callPackage ./plugins/copyartifacts.nix { beets = self.beets-minimal; }; - filetote = callPackage ./plugins/filetote.nix { beets = self.beets-minimal; }; - } - // lib.optionalAttrs config.allowAliases { - beets-unstable = lib.warn "beets-unstable was aliased to beets, since upstream releases are frequent nowadays" self.beets; - - extrafiles = throw "extrafiles is unmaintained since 2020 and broken since beets 2.0.0"; - } -) diff --git a/pkgs/tools/audio/beets/plugins/alternatives.nix b/pkgs/tools/audio/beets/plugins/alternatives.nix deleted file mode 100644 index 9e5a8182e47b..000000000000 --- a/pkgs/tools/audio/beets/plugins/alternatives.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - lib, - fetchFromGitHub, - beets, - python3Packages, - writableTmpDirAsHomeHook, -}: - -python3Packages.buildPythonApplication rec { - pname = "beets-alternatives"; - version = "0.13.4"; - pyproject = true; - - src = fetchFromGitHub { - repo = "beets-alternatives"; - owner = "geigerzaehler"; - tag = "v${version}"; - hash = "sha256-jGHRoBBXqJq0r/Gbp7gkuaEFPVMGE6cqQRi84AHTXxQ="; - }; - - nativeBuildInputs = [ - beets - ]; - - dependencies = [ - python3Packages.poetry-core - ]; - - nativeCheckInputs = - with python3Packages; - [ - pytestCheckHook - pytest-cov-stub - mock - pillow - tomli - typeguard - ] - ++ [ - writableTmpDirAsHomeHook - ]; - - meta = { - description = "Beets plugin to manage external files"; - homepage = "https://github.com/geigerzaehler/beets-alternatives"; - changelog = "https://github.com/geigerzaehler/beets-alternatives/blob/v${version}/CHANGELOG.md"; - maintainers = with lib.maintainers; [ - aszlig - lovesegfault - ]; - license = lib.licenses.mit; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 7fde68cec227..d1246b076e33 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -545,7 +545,8 @@ mapAliases { beam_nox = throw "beam_nox has been removed in favor of beam_minimal or beamMinimalPackages"; # Added 2025-04-01 BeatSaberModManager = beatsabermodmanager; # Added 2024-06-12 beatsabermodmanager = throw "'beatsabermodmanager' has been removed due to lack of upstream maintainenance. Consider using 'bs-manager' instead"; # Added 2025-03-18 - beets-unstable = beetsPackages.beets-unstable; # Added 2025-09-24 + beets-unstable = throw "beets-unstable has been removed in favor of beets since upstream is releasing versions frequently nowadays"; # Added 2025-10-16 + beetsPackages = throw "beetsPackages were replaced with python3.pkgs.beets- prefixed attributes, and top-level beets* attributes"; # Added 2025-10-16 belcard = throw "'belcard' has been moved to 'linphonePackages.belcard'"; # Added 2025-09-20 belle-sip = throw "'belle-sip' has been moved to 'linphonePackages.belle-sip'"; # Added 2025-09-20 belr = throw "'belr' has been moved to 'linphonePackages.belr'"; # Added 2025-09-20 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dea6298048fc..1fcc0bb27779 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2327,9 +2327,6 @@ with pkgs; usePoppler = true; }; - beetsPackages = lib.recurseIntoAttrs (callPackage ../tools/audio/beets { }); - inherit (beetsPackages) beets; - binlore = callPackage ../development/tools/analysis/binlore { }; birdfont = callPackage ../tools/misc/birdfont { }; diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 736591ee02b1..03f55add971b 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -110,6 +110,9 @@ mapAliases { backports_weakref = throw "backports_weakref has been removed, since we no longer need to backport to python3.3"; # added 2023-07-28 bash_kernel = bash-kernel; # added 2023-11-10 beancount_docverif = beancount-docverif; # added 2023-10-08 + beets-unstable = lib.warn "beets-unstable was aliased to beets, since upstream releases are frequent nowadays" self.beets; # added 2025-10-16; + beets-stable = lib.warn "beets-stable was aliased to beets, since upstream releases are frequent nowadays" self.beets; # added 2025-10-16; + beets-extrafiles = throw "beets-extrafiles is unmaintained since 2020 and broken since beets 2.0.0"; bedup = throw "bedup was removed because it was broken and abandoned upstream"; # added 2023-02-04 bip_utils = bip-utils; # 2023-10-08 bitcoin-price-api = throw "bitcoin-price-api has been removed, it was using setuptools 2to3 translation feautre, which has been removed in setuptools 58"; # added 2022-02-15 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7c30ff851608..5f3af98436e1 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1834,7 +1834,21 @@ self: super: with self; { beetcamp = callPackage ../development/python-modules/beetcamp { }; - beets = toPythonModule (pkgs.beets.override { python3Packages = self; }); + beets = callPackage ../development/python-modules/beets { + inherit (pkgs) chromaprint; + }; + + beets-alternatives = callPackage ../development/python-modules/beets-alternatives { }; + + beets-audible = callPackage ../development/python-modules/beets-audible { }; + + beets-copyartifacts = callPackage ../development/python-modules/beets-copyartifacts { }; + + beets-filetote = callPackage ../development/python-modules/beets-filetote { }; + + beets-minimal = beets.override { + disableAllPlugins = true; + }; beewi-smartclim = callPackage ../development/python-modules/beewi-smartclim { };