1- { fetchpatch
2- , bashInteractive
3- , diffPlugins
4- , glibcLocales
5- , gobject-introspection
6- , gst_all_1
7- , lib
8- , python3Packages
9- , sphinxHook
10- , runtimeShell
11- , writeScript
12-
13- # plugin deps
14- , aacgain
15- , essentia-extractor
16- , ffmpeg
17- , flac
18- , imagemagick
19- , keyfinder-cli
20- , mp3gain
21- , mp3val
22-
23- , src
24- , version
25- , extraPatches ? [ ]
26- , pluginOverrides ? { }
27- , disableAllPlugins ? false
28- , disabledTests ? [ ]
29- , extraNativeBuildInputs ? [ ]
1+ {
2+ lib ,
3+ src ,
4+ version ,
5+ bashInteractive ,
6+ diffPlugins ,
7+ gobject-introspection ,
8+ gst_all_1 ,
9+ python3Packages ,
10+ sphinxHook ,
11+ runtimeShell ,
12+ writeScript ,
13+
14+ # plugin deps, used indirectly by the @inputs when we `import ./builtin-plugins.nix`
15+ aacgain ,
16+ essentia-extractor ,
17+ ffmpeg ,
18+ flac ,
19+ imagemagick ,
20+ keyfinder-cli ,
21+ mp3gain ,
22+ mp3val ,
23+
24+ extraPatches ? [ ] ,
25+ pluginOverrides ? { } ,
26+ disableAllPlugins ? false ,
27+ disabledTests ? [ ] ,
28+ extraNativeBuildInputs ? [ ] ,
3029
3130 # tests
32- , runCommand
33- , beets
31+ runCommand ,
32+ beets ,
3433} @inputs :
3534let
3635 inherit ( lib ) attrNames attrValues concatMap ;
3736
38- mkPlugin = { name
39- , enable ? ! disableAllPlugins
40- , builtin ? false
41- , propagatedBuildInputs ? [ ]
42- , testPaths ? [
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"
47- else
48- "test/plugins/test_${ name } .py"
49- )
50- ]
51- , wrapperBins ? [ ]
52- } : {
53- inherit name enable builtin propagatedBuildInputs testPaths wrapperBins ;
54- } ;
37+ mkPlugin =
38+ {
39+ name ,
40+ enable ? ! disableAllPlugins ,
41+ builtin ? false ,
42+ propagatedBuildInputs ? [ ] ,
43+ testPaths ? [
44+ "test/plugins/test_${ name } .py"
45+ ] ,
46+ wrapperBins ? [ ] ,
47+ } :
48+ {
49+ inherit
50+ name
51+ enable
52+ builtin
53+ propagatedBuildInputs
54+ testPaths
55+ wrapperBins
56+ ;
57+ } ;
5558
5659 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+ pluginOverrides' = lib . mapAttrs (
61+ plugName :
62+ lib . throwIf ( basePlugins . ${ plugName } . deprecated or false )
6063 "beets evaluation error: Plugin ${ plugName } was enabled in pluginOverrides, but it has been removed. Remove the override to fix evaluation."
61- )
62- pluginOverrides
63- ;
64+ ) pluginOverrides ;
6465
65- allPlugins = lib . mapAttrs ( n : a : mkPlugin { name = n ; } // a ) ( lib . recursiveUpdate basePlugins pluginOverrides' ) ;
66+ allPlugins = lib . mapAttrs ( n : a : mkPlugin { name = n ; } // a ) (
67+ lib . recursiveUpdate basePlugins pluginOverrides'
68+ ) ;
6669 builtinPlugins = lib . filterAttrs ( _ : p : p . builtin ) allPlugins ;
6770 enabledPlugins = lib . filterAttrs ( _ : p : p . enable ) allPlugins ;
6871 disabledPlugins = lib . filterAttrs ( _ : p : ! p . enable ) allPlugins ;
72+ disabledTestPaths = lib . flatten ( attrValues ( lib . mapAttrs ( _ : v : v . testPaths ) disabledPlugins ) ) ;
6973
7074 pluginWrapperBins = concatMap ( p : p . wrapperBins ) ( attrValues enabledPlugins ) ;
7175in
@@ -75,36 +79,48 @@ python3Packages.buildPythonApplication {
7579
7680 patches = extraPatches ;
7781
78- propagatedBuildInputs = with python3Packages ; [
79- confuse
80- gst-python
81- jellyfish
82- mediafile
83- munkres
84- musicbrainzngs
85- mutagen
86- pygobject3
87- pyyaml
88- reflink
89- unidecode
90- typing-extensions
91- ] ++ ( concatMap ( p : p . propagatedBuildInputs ) ( attrValues enabledPlugins ) ) ;
82+ propagatedBuildInputs =
83+ with python3Packages ;
84+ [
85+ confuse
86+ gst-python
87+ jellyfish
88+ mediafile
89+ munkres
90+ musicbrainzngs
91+ mutagen
92+ pygobject3
93+ pyyaml
94+ reflink
95+ unidecode
96+ typing-extensions
97+ ]
98+ ++ ( concatMap ( p : p . propagatedBuildInputs ) ( attrValues enabledPlugins ) ) ;
9299
93100 nativeBuildInputs = [
94101 gobject-introspection
95102 sphinxHook
96103 python3Packages . pydata-sphinx-theme
97104 ] ++ extraNativeBuildInputs ;
98105
99- buildInputs = [
100- ] ++ ( with gst_all_1 ; [
101- gst-plugins-base
102- gst-plugins-good
103- gst-plugins-ugly
104- ] ) ;
105-
106- outputs = [ "out" "doc" "man" ] ;
107- sphinxBuilders = [ "html" "man" ] ;
106+ buildInputs =
107+ [
108+ ]
109+ ++ ( with gst_all_1 ; [
110+ gst-plugins-base
111+ gst-plugins-good
112+ gst-plugins-ugly
113+ ] ) ;
114+
115+ outputs = [
116+ "out"
117+ "doc"
118+ "man"
119+ ] ;
120+ sphinxBuilders = [
121+ "html"
122+ "man"
123+ ] ;
108124
109125 postInstall = ''
110126 mkdir -p $out/share/zsh/site-functions
@@ -117,17 +133,20 @@ python3Packages.buildPythonApplication {
117133 "--prefix PATH : ${ lib . makeBinPath pluginWrapperBins } "
118134 ] ;
119135
120- nativeCheckInputs = with python3Packages ; [
121- pytestCheckHook
122- pytest-cov
123- mock
124- rarfile
125- responses
126- ] ++ pluginWrapperBins ;
136+ nativeCheckInputs =
137+ with python3Packages ;
138+ [
139+ pytestCheckHook
140+ pytest-cov
141+ mock
142+ rarfile
143+ responses
144+ ]
145+ ++ pluginWrapperBins ;
127146
128147 __darwinAllowLocalNetworking = true ;
129148
130- disabledTestPaths = lib . flatten ( attrValues ( lib . mapAttrs ( _ : v : v . testPaths ) disabledPlugins ) ) ;
149+ inherit disabledTestPaths ;
131150 inherit disabledTests ;
132151
133152 # Perform extra "sanity checks", before running pytest tests.
@@ -152,30 +171,38 @@ python3Packages.buildPythonApplication {
152171 env EDITOR=true "$out/bin/beet" config -e
153172 '' ;
154173
155-
156174 passthru . plugins = allPlugins ;
157175
158- passthru . tests . gstreamer = runCommand "beets-gstreamer-test" {
159- meta . timeout = 60 ;
160- } ''
161- set -euo pipefail
162- export HOME=$(mktemp -d)
163- mkdir $out
164-
165- cat << EOF > $out/config.yaml
166- replaygain:
167- backend: gstreamer
168- EOF
169-
170- ${ beets } /bin/beet -c $out/config.yaml > /dev/null
171- '' ;
172-
173- meta = with lib ; {
176+ passthru . tests . gstreamer =
177+ runCommand "beets-gstreamer-test"
178+ {
179+ meta . timeout = 60 ;
180+ }
181+ ''
182+ set -euo pipefail
183+ export HOME=$(mktemp -d)
184+ mkdir $out
185+
186+ cat << EOF > $out/config.yaml
187+ replaygain:
188+ backend: gstreamer
189+ EOF
190+
191+ ${ beets } /bin/beet -c $out/config.yaml > /dev/null
192+ '' ;
193+
194+ meta = {
174195 description = "Music tagger and library organizer" ;
175196 homepage = "https://beets.io" ;
176- license = licenses . mit ;
177- maintainers = with maintainers ; [ aszlig doronbehar lovesegfault montchr pjones ] ;
178- platforms = platforms . linux ++ platforms . darwin ;
197+ license = lib . licenses . mit ;
198+ maintainers = with lib . maintainers ; [
199+ aszlig
200+ doronbehar
201+ lovesegfault
202+ montchr
203+ pjones
204+ ] ;
205+ platforms = lib . platforms . linux ++ lib . platforms . darwin ;
179206 mainProgram = "beet" ;
180207 } ;
181208}
0 commit comments