5 , gobject-introspection
26 , pluginOverrides ? { }
27 , disableAllPlugins ? false
29 , extraNativeBuildInputs ? []
36 inherit (lib) attrNames attrValues concatMap;
39 , enable ? !disableAllPlugins
41 , propagatedBuildInputs ? [ ]
43 # NOTE: This conditional can be removed when beets-stable is updated and
44 # the default plugins test path is changed
45 (if (lib.versions.majorMinor version) == "1.6" then
46 "test/test_${name}.py"
48 "test/plugins/test_${name}.py"
53 inherit name enable builtin propagatedBuildInputs testPaths wrapperBins;
56 basePlugins = lib.mapAttrs (_: a: { builtin = true; } // a) (import ./builtin-plugins.nix inputs);
57 pluginOverrides' = lib.mapAttrs
58 (plugName: lib.throwIf
59 (basePlugins.${plugName}.deprecated or false)
60 "beets evaluation error: Plugin ${plugName} was enabled in pluginOverrides, but it has been removed. Remove the override to fix evaluation."
65 allPlugins = lib.mapAttrs ( n: a: mkPlugin { name = n; } // a) (lib.recursiveUpdate basePlugins pluginOverrides');
66 builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins;
67 enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins;
68 disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins;
70 pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins);
72 python3Packages.buildPythonApplication {
76 patches = extraPatches;
78 propagatedBuildInputs = with python3Packages; [
91 ] ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));
96 python3Packages.pydata-sphinx-theme
97 ] ++ extraNativeBuildInputs;
100 ] ++ (with gst_all_1; [
106 outputs = [ "out" "doc" "man" ];
107 sphinxBuilders = [ "html" "man" ];
110 mkdir -p $out/share/zsh/site-functions
111 cp extra/_beet $out/share/zsh/site-functions/
115 "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
116 "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
117 "--prefix PATH : ${lib.makeBinPath pluginWrapperBins}"
120 nativeCheckInputs = with python3Packages; [
126 ] ++ pluginWrapperBins;
128 disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins));
129 inherit disabledTests;
131 # Perform extra "sanity checks", before running pytest tests.
133 # Check for undefined plugins
134 find beetsplug -mindepth 1 \
135 \! -path 'beetsplug/__init__.py' -a \
136 \( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \
137 | sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \
138 | sort -u > plugins_available
139 ${diffPlugins (attrNames builtinPlugins) "plugins_available"}
141 export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc"
142 export HOME="$(mktemp -d)"
144 env EDITOR="${writeScript "beetconfig.sh" ''
147 plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
149 ''}" "$out/bin/beet" config -e
150 env EDITOR=true "$out/bin/beet" config -e
154 passthru.plugins = allPlugins;
156 passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
160 export HOME=$(mktemp -d)
163 cat << EOF > $out/config.yaml
168 ${beets}/bin/beet -c $out/config.yaml > /dev/null
172 description = "Music tagger and library organizer";
173 homepage = "https://beets.io";
174 license = licenses.mit;
175 maintainers = with maintainers; [ aszlig doronbehar lovesegfault pjones ];
176 platforms = platforms.linux;
177 mainProgram = "beet";