5 , gobject-introspection
24 , pluginOverrides ? { }
25 , disableAllPlugins ? false
32 inherit (lib) attrNames attrValues concatMap;
34 mkPlugin = { enable ? !disableAllPlugins, builtin ? false, propagatedBuildInputs ? [ ], testPaths ? [ ], wrapperBins ? [ ] }: {
35 inherit enable builtin propagatedBuildInputs testPaths wrapperBins;
38 basePlugins = lib.mapAttrs (_: a: { builtin = true; } // a) (import ./builtin-plugins.nix inputs);
39 allPlugins = lib.mapAttrs (_: mkPlugin) (lib.recursiveUpdate basePlugins pluginOverrides);
40 builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins;
41 enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins;
42 disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins;
44 pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins);
46 python3Packages.buildPythonApplication rec {
51 # Bash completion fix for Nix
52 ./patches/bash-completion-always-print.patch
55 propagatedBuildInputs = with python3Packages; [
68 ] ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));
70 # see: https://github.com/NixOS/nixpkgs/issues/56943#issuecomment-1131643663
76 ] ++ (with gst_all_1; [
83 mkdir -p $out/share/zsh/site-functions
84 cp extra/_beet $out/share/zsh/site-functions/
87 doInstallCheck = true;
89 installCheckPhase = ''
90 runHook preInstallCheck
92 tmphome="$(mktemp -d)"
94 EDITOR="${writeScript "beetconfig.sh" ''
97 plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
99 ''}" HOME="$tmphome" "$out/bin/beet" config -e
100 EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
102 runHook postInstallCheck
106 "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
107 "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
108 "--prefix PATH : ${lib.makeBinPath pluginWrapperBins}"
111 checkInputs = with python3Packages; [
116 ] ++ pluginWrapperBins;
118 disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins));
123 # Check for undefined plugins
124 find beetsplug -mindepth 1 \
125 \! -path 'beetsplug/__init__.py' -a \
126 \( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \
127 | sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \
128 | sort -u > plugins_available
129 ${diffPlugins (attrNames builtinPlugins) "plugins_available"}
131 export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc"
132 export HOME="$(mktemp -d)"
134 args=" -m pytest -r fEs"
135 eval "disabledTestPaths=($disabledTestPaths)"
136 for path in ''${disabledTestPaths[@]}; do
137 if [ -e "$path" ]; then
138 args+=" --ignore $path"
140 echo "Skipping non-existent test path '$path'"
150 passthru.plugins = allPlugins;
152 passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
157 export HOME=$(mktemp -d)
160 cat << EOF > $out/config.yaml
165 echo $out/config.yaml
166 ${beets}/bin/beet -c $out/config.yaml > /dev/null
170 description = "Music tagger and library organizer";
171 homepage = "https://beets.io";
172 license = licenses.mit;
173 maintainers = with maintainers; [ aszlig doronbehar lovesegfault pjones ];
174 platforms = platforms.linux;