From d9910fc92819cc8290da84bdcddf991dacf06cf6 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sat, 7 May 2022 13:42:01 -0700 Subject: [PATCH 01/11] beets: refactor Highlights: * We now have a beets-unstable * We now run tests for beets-minimal * We're much more strict about the effects of enabling/disabling plugins * All patches but one were dropped * Removal of deprecated nose in favor of pytest * Art resizing is working better now --- .../beets/badfiles-plugin-nix-paths.patch | 21 -- pkgs/tools/audio/beets/builtin-plugins.nix | 94 ++++++ pkgs/tools/audio/beets/common.nix | 147 +++++++++ .../beets/convert-plugin-ffmpeg-path.patch | 34 -- pkgs/tools/audio/beets/default.nix | 298 ++---------------- .../audio/beets/imagemagick-nix-path.patch | 20 -- .../bash-completion-always-print.patch | 0 .../audio/beets/plugins/alternatives.nix | 6 +- .../audio/beets/plugins/copyartifacts.nix | 6 +- pkgs/tools/audio/beets/plugins/extrafiles.nix | 6 +- .../beets/replaygain-default-ffmpeg.patch | 26 -- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 24 +- 13 files changed, 281 insertions(+), 402 deletions(-) delete mode 100644 pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch create mode 100644 pkgs/tools/audio/beets/builtin-plugins.nix create mode 100644 pkgs/tools/audio/beets/common.nix delete mode 100644 pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch delete mode 100644 pkgs/tools/audio/beets/imagemagick-nix-path.patch rename pkgs/tools/audio/beets/{ => patches}/bash-completion-always-print.patch (100%) delete mode 100644 pkgs/tools/audio/beets/replaygain-default-ffmpeg.patch diff --git a/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch b/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch deleted file mode 100644 index 6956183344c4..000000000000 --- a/pkgs/tools/audio/beets/badfiles-plugin-nix-paths.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git i/beetsplug/badfiles.py w/beetsplug/badfiles.py -index 36b45de3..5208b696 100644 ---- i/beetsplug/badfiles.py -+++ w/beetsplug/badfiles.py -@@ -71,14 +71,14 @@ class BadFiles(BeetsPlugin): - return status, errors, [line for line in output.split("\n") if line] - - def check_mp3val(self, path): -- status, errors, output = self.run_command(["mp3val", path]) -+ status, errors, output = self.run_command(["@mp3val@/bin/mp3val", path]) - if status == 0: - output = [line for line in output if line.startswith("WARNING:")] - errors = len(output) - return status, errors, output - - def check_flac(self, path): -- return self.run_command(["flac", "-wst", path]) -+ return self.run_command(["@flac@/bin/flac", "-wst", path]) - - def check_custom(self, command): - def checker(path): diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix new file mode 100644 index 000000000000..ee7da8d2033f --- /dev/null +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -0,0 +1,94 @@ +{ stdenv, lib +, aacgain ? null +, essentia-extractor ? null +, ffmpeg ? null +, flac ? null +, imagemagick ? null +, keyfinder-cli ? null +, mp3gain ? null +, mp3val ? null +, python3Packages +, ... +}: { + absubmit = { + enable = lib.elem stdenv.hostPlatform essentia-extractor.meta.platforms; + wrapperBins = [ essentia-extractor ]; + }; + acousticbrainz.propagatedBuildInputs = [ python3Packages.requests ]; + albumtypes = { }; + aura.propagatedBuildInputs = with python3Packages; [ flask pillow ]; + badfiles.wrapperBins = [ mp3val flac ]; + bareasc = { }; + beatport.propagatedBuildInputs = [ python3Packages.requests-oauthlib ]; + bench = { }; + bpd = { }; + bpm = { }; + bpsync = { }; + bucket = { }; + chroma.propagatedBuildInputs = [ python3Packages.pyacoustid ]; + convert.wrapperBins = [ ffmpeg ]; + deezer.propagatedBuildInputs = [ python3Packages.requests ]; + discogs.propagatedBuildInputs = with python3Packages; [ discogs-client requests ]; + duplicates = { }; + edit = { }; + embedart = { + propagatedBuildInputs = with python3Packages; [ pillow ]; + wrapperBins = [ imagemagick ]; + }; + embyupdate.propagatedBuildInputs = [ python3Packages.requests ]; + export = { }; + fetchart = { + propagatedBuildInputs = with python3Packages; [ requests pillow ]; + wrapperBins = [ imagemagick ]; + }; + filefilter = { }; + fish = { }; + freedesktop = { }; + fromfilename = { }; + ftintitle = { }; + fuzzy = { }; + gmusic = { }; + hook = { }; + ihate = { }; + importadded = { }; + importfeeds = { }; + info = { }; + inline = { }; + ipfs = { }; + keyfinder.wrapperBins = [ keyfinder-cli ]; + kodiupdate.propagatedBuildInputs = [ python3Packages.requests ]; + lastgenre.propagatedBuildInputs = [ python3Packages.pylast ]; + lastimport.propagatedBuildInputs = [ python3Packages.pylast ]; + loadext.propagatedBuildInputs = [ python3Packages.requests ]; + lyrics.propagatedBuildInputs = [ python3Packages.beautifulsoup4 ]; + mbcollection = { }; + mbsubmit = { }; + mbsync = { }; + metasync = { }; + missing = { }; + mpdstats.propagatedBuildInputs = [ python3Packages.mpd2 ]; + mpdupdate.propagatedBuildInputs = [ python3Packages.mpd2 ]; + parentwork = { }; + permissions = { }; + play = { }; + playlist.propagatedBuildInputs = [ python3Packages.requests ]; + plexupdate = { }; + random = { }; + replaygain.wrapperBins = [ aacgain ffmpeg mp3gain ]; + rewrite = { }; + scrub = { }; + smartplaylist = { }; + sonosupdate.propagatedBuildInputs = [ python3Packages.soco ]; + spotify = { }; + subsonicplaylist.propagatedBuildInputs = [ python3Packages.requests ]; + subsonicupdate.propagatedBuildInputs = [ python3Packages.requests ]; + the = { }; + thumbnails = { + propagatedBuildInputs = with python3Packages; [ pillow pyxdg ]; + wrapperBins = [ imagemagick ]; + }; + types.testPaths = [ "test/test_types_plugin.py" ]; + unimported = { }; + web.propagatedBuildInputs = [ python3Packages.flask ]; + zero = { }; +} diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix new file mode 100644 index 000000000000..51391a639cc5 --- /dev/null +++ b/pkgs/tools/audio/beets/common.nix @@ -0,0 +1,147 @@ +{ stdenv, lib +, bashInteractive +, diffPlugins +, glibcLocales +, gobject-introspection +, gst_all_1 +, python3Packages +, runtimeShell +, writeScript + + # plugin deps +, aacgain ? null +, essentia-extractor ? null +, ffmpeg ? null +, flac ? null +, imagemagick ? null +, keyfinder-cli ? null +, mp3gain ? null +, mp3val ? null + +, src +, version +, pluginOverrides ? { } +, disableAllPlugins ? false +}@inputs: +let + inherit (lib) attrNames attrValues concatMap; + + builtinPlugins = import ./builtin-plugins.nix inputs; + + mkPlugin = { enable ? !disableAllPlugins, propagatedBuildInputs ? [ ], testPaths ? [ ], wrapperBins ? [ ] }: { + inherit enable propagatedBuildInputs testPaths wrapperBins; + }; + + allPlugins = lib.mapAttrs (_: mkPlugin) (lib.recursiveUpdate builtinPlugins pluginOverrides); + enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins; + disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins; + + pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins); +in +python3Packages.buildPythonApplication rec { + pname = "beets"; + inherit src version; + + patches = [ + # Bash completion fix for Nix + ./patches/bash-completion-always-print.patch + ]; + + propagatedBuildInputs = with python3Packages; [ + confuse + enum34 + gobject-introspection + gst-python + jellyfish + mediafile + munkres + musicbrainzngs + mutagen + pygobject3 + pyyaml + reflink + unidecode + ] ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins)); + + buildInputs = [ + ] ++ (with gst_all_1; [ + gst-plugins-base + gst-plugins-good + gst-plugins-ugly + ]); + + postInstall = '' + mkdir -p $out/share/zsh/site-functions + cp extra/_beet $out/share/zsh/site-functions/ + ''; + + doInstallCheck = true; + + installCheckPhase = '' + runHook preInstallCheck + + tmphome="$(mktemp -d)" + + EDITOR="${writeScript "beetconfig.sh" '' + #!${runtimeShell} + cat > "$1" < plugins_available + ${diffPlugins (attrNames allPlugins) "plugins_available"} + + export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" + export HOME="$(mktemp -d)" + + args=" -m pytest -r fEs" + eval "disabledTestPaths=($disabledTestPaths)" + for path in ''${disabledTestPaths[@]}; do + if [ -e "$path" ]; then + args+=" --ignore \"$path\"" + else + echo "Skipping non-existent test path '$path'" + fi + done + + eval "python $args" + + runHook postCheck + ''; + + meta = with lib; { + description = "Music tagger and library organizer"; + homepage = "https://beets.io"; + license = licenses.mit; + maintainers = with maintainers; [ aszlig doronbehar lovesegfault pjones ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch b/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch deleted file mode 100644 index 1bc178934486..000000000000 --- a/pkgs/tools/audio/beets/convert-plugin-ffmpeg-path.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff --git i/beetsplug/convert.py w/beetsplug/convert.py -index 6bc07c28..039fb452 100644 ---- i/beetsplug/convert.py -+++ w/beetsplug/convert.py -@@ -118,22 +118,22 @@ class ConvertPlugin(BeetsPlugin): - 'id3v23': 'inherit', - 'formats': { - 'aac': { -- 'command': 'ffmpeg -i $source -y -vn -acodec aac ' -+ 'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec aac ' - '-aq 1 $dest', - 'extension': 'm4a', - }, - 'alac': { -- 'command': 'ffmpeg -i $source -y -vn -acodec alac $dest', -+ 'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec alac $dest', - 'extension': 'm4a', - }, -- 'flac': 'ffmpeg -i $source -y -vn -acodec flac $dest', -- 'mp3': 'ffmpeg -i $source -y -vn -aq 2 $dest', -+ 'flac': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec flac $dest', -+ 'mp3': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -aq 2 $dest', - 'opus': -- 'ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest', -+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest', - 'ogg': -- 'ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest', -+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest', - 'wma': -- 'ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest', -+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest', - }, - 'max_bitrate': 500, - 'auto': False, diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 0bdbe9d345db..d312ec9b6271 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -1,279 +1,37 @@ -{ stdenv -, lib +{ lib +, callPackage , fetchFromGitHub -, writeScript -, glibcLocales -, diffPlugins -, substituteAll -, pythonPackages -# can be null, if you wish to disable a reference to it. It's needed for the -# artresizer, see: -# https://beets.readthedocs.io/en/v1.6.0/plugins/fetchart.html#image-resizing -, imagemagick -, gobject-introspection -, gst_all_1 -, runtimeShell - -# external plugins package set -, beetsExternalPlugins - -, enableAbsubmit ? lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms, essentia-extractor -, enableAcousticbrainz ? true -, enableAcoustid ? true -, enableAura ? true -, enableBadfiles ? true, flac, mp3val -, enableBeatport ? true -, enableBpsync ? true -, enableConvert ? true, ffmpeg -, enableDeezer ? true -, enableDiscogs ? true -, enableEmbyupdate ? true -, enableFetchart ? true -, enableKeyfinder ? true, keyfinder-cli -, enableKodiupdate ? true -, enableLastfm ? true -, enableLoadext ? true -, enableLyrics ? true -, enableMpd ? true -, enablePlaylist ? true -, enableReplaygain ? true -, enableSonosUpdate ? true -, enableSubsonicplaylist ? true -, enableSubsonicupdate ? true -, enableThumbnails ? true -, enableWeb ? true - -# External plugins -, enableAlternatives ? false -, enableCopyArtifacts ? false -, enableExtraFiles ? false - -, bashInteractive, bash-completion }: -assert enableBpsync -> enableBeatport; +lib.makeExtensible (self: { + beets = self.beets-stable; -let - optionalPlugins = { - absubmit = enableAbsubmit; - acousticbrainz = enableAcousticbrainz; - aura = enableAura; - badfiles = enableBadfiles; - beatport = enableBeatport; - bpsync = enableBpsync; - chroma = enableAcoustid; - convert = enableConvert; - deezer = enableDeezer; - discogs = enableDiscogs; - embyupdate = enableEmbyupdate; - fetchart = enableFetchart; - keyfinder = enableKeyfinder; - kodiupdate = enableKodiupdate; - lastgenre = enableLastfm; - lastimport = enableLastfm; - loadext = enableLoadext; - lyrics = enableLyrics; - mpdstats = enableMpd; - mpdupdate = enableMpd; - playlist = enablePlaylist; - replaygain = enableReplaygain; - sonosupdate = enableSonosUpdate; - subsonicplaylist = enableSubsonicplaylist; - subsonicupdate = enableSubsonicupdate; - thumbnails = enableThumbnails; - web = enableWeb; + beets-stable = callPackage ./common.nix rec { + version = "1.6.0"; + src = fetchFromGitHub { + owner = "beetbox"; + repo = "beets"; + rev = "v${version}"; + hash = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM="; + }; }; - pluginsWithoutDeps = [ - "albumtypes" "bareasc" "bench" "bpd" "bpm" "bucket" "duplicates" "edit" "embedart" - "export" "filefilter" "fish" "freedesktop" "fromfilename" "ftintitle" "fuzzy" - "hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs" "gmusic" - "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "parentwork" "permissions" "play" - "plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the" - "types" "unimported" "zero" - ]; + beets-minimal = self.beets.override { disableAllPlugins = true; }; - enabledOptionalPlugins = lib.attrNames (lib.filterAttrs (_: lib.id) optionalPlugins); - - allPlugins = pluginsWithoutDeps ++ lib.attrNames optionalPlugins; - allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins; - - testShell = "${bashInteractive}/bin/bash --norc"; - completion = "${bash-completion}/share/bash-completion/bash_completion"; - -in pythonPackages.buildPythonApplication rec { - pname = "beets"; - version = "1.6.0"; - - src = fetchFromGitHub { - owner = "beetbox"; - repo = "beets"; - rev = "v${version}"; - sha256 = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM="; + beets-unstable = callPackage ./common.nix { + version = "unstable-2022-05-08"; + src = fetchFromGitHub { + owner = "beetbox"; + repo = "beets"; + rev = "e06cf7969bfdfa4773049699320471be45d56054"; + hash = "sha256-yWwxYSzSSmx2UfCn0EBH23hQGZKSRn/c8ryvxLUeHdM="; + }; + pluginOverrides = { + limit = { }; + }; }; - propagatedBuildInputs = [ - pythonPackages.six - pythonPackages.enum34 - pythonPackages.jellyfish - pythonPackages.munkres - pythonPackages.musicbrainzngs - pythonPackages.mutagen - pythonPackages.pyyaml - pythonPackages.unidecode - pythonPackages.gst-python - pythonPackages.pygobject3 - pythonPackages.reflink - pythonPackages.confuse - pythonPackages.mediafile - gobject-introspection - ] ++ lib.optional enableAbsubmit essentia-extractor - ++ lib.optional enableAcoustid pythonPackages.pyacoustid - ++ lib.optional enableBeatport pythonPackages.requests-oauthlib - ++ lib.optional enableConvert ffmpeg - ++ lib.optional enableDiscogs pythonPackages.discogs-client - ++ lib.optional (enableFetchart - || enableDeezer - || enableEmbyupdate - || enableKodiupdate - || enableLoadext - || enablePlaylist - || enableSubsonicplaylist - || enableSubsonicupdate - || enableAcousticbrainz) pythonPackages.requests - ++ lib.optional enableKeyfinder keyfinder-cli - ++ lib.optional enableLastfm pythonPackages.pylast - ++ lib.optional enableLyrics pythonPackages.beautifulsoup4 - ++ lib.optional enableMpd pythonPackages.mpd2 - ++ lib.optional enableSonosUpdate pythonPackages.soco - ++ lib.optional enableThumbnails pythonPackages.pyxdg - ++ lib.optional (enableAura - || enableWeb) pythonPackages.flask - ++ lib.optional enableAlternatives beetsExternalPlugins.alternatives - ++ lib.optional enableCopyArtifacts beetsExternalPlugins.copyartifacts - ++ lib.optional enableExtraFiles beetsExternalPlugins.extrafiles - ; - - buildInputs = [ - ] ++ (with gst_all_1; [ - gst-plugins-base - gst-plugins-good - gst-plugins-ugly - ]); - - checkInputs = with pythonPackages; [ - beautifulsoup4 - mock - nose - rarfile - responses - # Although considered as plugin dependencies, they are needed for the - # tests, for disabling them via an override makes the build fail. see: - # https://github.com/beetbox/beets/blob/v1.6.0/setup.py - pylast - mpd2 - discogs-client - pyxdg - ]; - - patches = [ - # Bash completion fix for Nix - ./bash-completion-always-print.patch - ] - # Fix path to imagemagick, used for the artresizer.py file. This reference - # to imagemagick might be expensive for some people, so the patch can be - # disabled if imagemagick is set to null - ++ lib.optional (imagemagick != null) (substituteAll { - src = ./imagemagick-nix-path.patch; - inherit imagemagick; - }) - # We need to force ffmpeg as the default, since we do not package - # bs1770gain, and set the absolute path there, to avoid impurities. - ++ lib.optional enableReplaygain (substituteAll { - src = ./replaygain-default-ffmpeg.patch; - ffmpeg = lib.getBin ffmpeg; - }) - # Put absolute Nix paths in place - ++ lib.optional enableConvert (substituteAll { - src = ./convert-plugin-ffmpeg-path.patch; - ffmpeg = lib.getBin ffmpeg; - }) - ++ lib.optional enableBadfiles (substituteAll { - src = ./badfiles-plugin-nix-paths.patch; - inherit mp3val flac; - }) - ; - - # Disable failing tests - postPatch = '' - echo echo completion tests passed > test/rsrc/test_completion.sh - - # https://github.com/beetbox/beets/issues/1187 - sed -i -e 's/len(mf.images)/0/' test/test_zero.py - ''; - - postInstall = '' - mkdir -p $out/share/zsh/site-functions - cp extra/_beet $out/share/zsh/site-functions/ - ''; - - doCheck = true; - - preCheck = '' - 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 allPlugins "plugins_available"} - ''; - - checkPhase = '' - runHook preCheck - - LANG=en_US.UTF-8 \ - LOCALE_ARCHIVE=${assert stdenv.isLinux; glibcLocales}/lib/locale/locale-archive \ - BEETS_TEST_SHELL="${testShell}" \ - BASH_COMPLETION_SCRIPT="${completion}" \ - HOME="$(mktemp -d)" nosetests -v - - runHook postCheck - ''; - - doInstallCheck = true; - - installCheckPhase = '' - runHook preInstallCheck - - tmphome="$(mktemp -d)" - - EDITOR="${writeScript "beetconfig.sh" '' - #!${runtimeShell} - cat > "$1" < Date: Sun, 8 May 2022 14:44:13 -0700 Subject: [PATCH 02/11] beetsPackages.beets-copyartifacts: use pytest --- pkgs/tools/audio/beets/plugins/copyartifacts.nix | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/copyartifacts.nix b/pkgs/tools/audio/beets/plugins/copyartifacts.nix index a1e8470c4e5e..623ca2fcf172 100644 --- a/pkgs/tools/audio/beets/plugins/copyartifacts.nix +++ b/pkgs/tools/audio/beets/plugins/copyartifacts.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, beets, python3Packages, glibcLocales }: +{ lib, fetchFromGitHub, beets, python3Packages }: python3Packages.buildPythonApplication { pname = "beets-copyartifacts"; @@ -15,20 +15,20 @@ python3Packages.buildPythonApplication { sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py sed -i -e '/namespace_packages/d' setup.py printf 'from pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n' >beetsplug/__init__.py - - # Skip test which is already failing upstream. - sed -i -e '1i import unittest' \ - -e 's/\(^ *\)# failing/\1@unittest.skip/' \ - tests/test_reimport.py ''; - nativeBuildInputs = [ beets python3Packages.nose glibcLocales ]; + pytestFlagsArray = [ "-r fEs" ]; - checkPhase = "LANG=en_US.UTF-8 nosetests"; + checkInputs = with python3Packages; [ + pytestCheckHook + beets + six + ]; meta = { description = "Beets plugin to move non-music files during the import process"; homepage = "https://github.com/sbarakat/beets-copyartifacts"; license = lib.licenses.mit; + inherit (beets.meta) platforms; }; } From 7a2d33cdf342a8a2858ba267e4b17df2058b006b Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 14:47:13 -0700 Subject: [PATCH 03/11] beetsPackages.beets-extrafiles: use pytest --- pkgs/tools/audio/beets/plugins/extrafiles.nix | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/extrafiles.nix b/pkgs/tools/audio/beets/plugins/extrafiles.nix index a6a5eb1e1bdb..7cd4c76d5045 100644 --- a/pkgs/tools/audio/beets/plugins/extrafiles.nix +++ b/pkgs/tools/audio/beets/plugins/extrafiles.nix @@ -1,6 +1,6 @@ { lib, fetchFromGitHub, beets, python3Packages }: -python3Packages.buildPythonApplication rec { +python3Packages.buildPythonApplication { pname = "beets-extrafiles"; version = "unstable-2020-12-13"; @@ -17,17 +17,21 @@ python3Packages.buildPythonApplication rec { sed -i -e 's/mediafile~=0.6.0/mediafile>=0.6.0/' setup.py ''; - nativeBuildInputs = [ beets ]; - propagatedBuildInputs = with python3Packages; [ mediafile ]; + checkInputs = [ + python3Packages.pytestCheckHook + beets + ]; + preCheck = '' - HOME=$TEMPDIR + HOME="$(mktemp -d)" ''; meta = { homepage = "https://github.com/Holzhaus/beets-extrafiles"; description = "A plugin for beets that copies additional files and directories during the import process"; license = lib.licenses.mit; + inherit (beets.meta) platforms; }; } From c9786cfb93a7e898e906f05d595357c37cf53ee5 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 16:21:29 -0700 Subject: [PATCH 04/11] beets: remove enum34 --- pkgs/tools/audio/beets/common.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 51391a639cc5..afd10f92c83c 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -49,7 +49,6 @@ python3Packages.buildPythonApplication rec { propagatedBuildInputs = with python3Packages; [ confuse - enum34 gobject-introspection gst-python jellyfish From efbb686d6a4f695c4248c23f5584112aae954b86 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 16:22:52 -0700 Subject: [PATCH 05/11] beets: don't use eval in checkPhase --- pkgs/tools/audio/beets/common.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index afd10f92c83c..d3b37ec499eb 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -131,7 +131,7 @@ python3Packages.buildPythonApplication rec { fi done - eval "python $args" + python $args runHook postCheck ''; From 06b03f2e6f46b5a1cfd8e866d010042eed8eca4e Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 16:23:45 -0700 Subject: [PATCH 06/11] beetsPackages: don't prepend names with beets- --- pkgs/tools/audio/beets/default.nix | 6 +++--- pkgs/top-level/aliases.nix | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index d312ec9b6271..61f14c526bfc 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -31,7 +31,7 @@ lib.makeExtensible (self: { }; }; - beets-alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; }; - beets-copyartifacts = callPackage ./plugins/copyartifacts.nix { beets = self.beets-minimal; }; - beets-extrafiles = callPackage ./plugins/extrafiles.nix { beets = self.beets-minimal; }; + alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; }; + copyartifacts = callPackage ./plugins/copyartifacts.nix { beets = self.beets-minimal; }; + extrafiles = callPackage ./plugins/extrafiles.nix { beets = self.beets-minimal; }; }) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 3fd6e1a4cbeb..0d0590952cf8 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -107,7 +107,7 @@ mapAliases ({ bazaar = throw "bazaar has been deprecated by breezy"; # Added 2020-04-19 bazaarTools = throw "bazaar has been deprecated by breezy"; # Added 2020-04-19 bcat = throw "bcat has been removed because upstream is dead"; # Added 2021-08-22 - beetsExternalPlugins = throw "beetsExternalPlugins has been deprecated, use beetsPackages.beets-$pluginname"; # Added 2022-05-07 + beetsExternalPlugins = throw "beetsExternalPlugins has been deprecated, use beetsPackages.$pluginname"; # Added 2022-05-07 beret = throw "beret has been removed"; # Added 2021-11-16 bin_replace_string = throw "bin_replace_string has been removed: deleted by upstream"; # Added 2022-01-07 bird2 = bird; # Added 2022-02-21 From 98a9194800c6b4834f2b415a0fb7e1a67383d934 Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 16:25:23 -0700 Subject: [PATCH 07/11] beetsPackages: fix input ordering --- pkgs/tools/audio/beets/builtin-plugins.nix | 3 ++- pkgs/tools/audio/beets/common.nix | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix index ee7da8d2033f..886ba7f66823 100644 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -1,10 +1,11 @@ -{ stdenv, lib +{ stdenv , aacgain ? null , essentia-extractor ? null , ffmpeg ? null , flac ? null , imagemagick ? null , keyfinder-cli ? null +, lib , mp3gain ? null , mp3val ? null , python3Packages diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index d3b37ec499eb..8007a1ffc60e 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -1,9 +1,10 @@ -{ stdenv, lib +{ stdenv , bashInteractive , diffPlugins , glibcLocales , gobject-introspection , gst_all_1 +, lib , python3Packages , runtimeShell , writeScript From 1551b57a5c66bf10dd282ecf4400da2d1a9af40f Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 8 May 2022 17:13:34 -0700 Subject: [PATCH 08/11] beets: fix absubmit enable condition --- pkgs/tools/audio/beets/builtin-plugins.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix index 886ba7f66823..86a29f77188d 100644 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -12,7 +12,7 @@ , ... }: { absubmit = { - enable = lib.elem stdenv.hostPlatform essentia-extractor.meta.platforms; + enable = lib.elem stdenv.hostPlatform.system essentia-extractor.meta.platforms; wrapperBins = [ essentia-extractor ]; }; acousticbrainz.propagatedBuildInputs = [ python3Packages.requests ]; From 6eab16313f83c13a13fff652622c0e6c5317ea0b Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Mon, 9 May 2022 12:19:56 -0700 Subject: [PATCH 09/11] beets: remove usage of ? null --- pkgs/tools/audio/beets/builtin-plugins.nix | 16 ++++++++-------- pkgs/tools/audio/beets/common.nix | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix index 86a29f77188d..1fef39ef72f5 100644 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -1,13 +1,13 @@ { stdenv -, aacgain ? null -, essentia-extractor ? null -, ffmpeg ? null -, flac ? null -, imagemagick ? null -, keyfinder-cli ? null +, aacgain +, essentia-extractor +, ffmpeg +, flac +, imagemagick +, keyfinder-cli , lib -, mp3gain ? null -, mp3val ? null +, mp3gain +, mp3val , python3Packages , ... }: { diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 8007a1ffc60e..3c7ad800c3b7 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -10,14 +10,14 @@ , writeScript # plugin deps -, aacgain ? null -, essentia-extractor ? null -, ffmpeg ? null -, flac ? null -, imagemagick ? null -, keyfinder-cli ? null -, mp3gain ? null -, mp3val ? null +, aacgain +, essentia-extractor +, ffmpeg +, flac +, imagemagick +, keyfinder-cli +, mp3gain +, mp3val , src , version From 069410f90b306f3b29f74eabbc2863051f3009ec Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Mon, 9 May 2022 12:20:20 -0700 Subject: [PATCH 10/11] beets: document pluginOverrides --- pkgs/tools/audio/beets/default.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 61f14c526bfc..58a746ee1aa7 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -2,7 +2,19 @@ , callPackage , fetchFromGitHub }: - +/* +** 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 ]; }; +** }; } +*/ lib.makeExtensible (self: { beets = self.beets-stable; From ddf809d7805edd0b4e5d7e5b2a957844697ff68d Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Tue, 10 May 2022 15:35:46 -0700 Subject: [PATCH 11/11] beets-unstable: document limit in pluginOverrides --- pkgs/tools/audio/beets/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 58a746ee1aa7..a66b018678c6 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -39,6 +39,7 @@ lib.makeExtensible (self: { hash = "sha256-yWwxYSzSSmx2UfCn0EBH23hQGZKSRn/c8ryvxLUeHdM="; }; pluginOverrides = { + # unstable has a new plugin, so we register it here. limit = { }; }; };