File tree Expand file tree Collapse file tree 3 files changed +47
-20
lines changed Expand file tree Collapse file tree 3 files changed +47
-20
lines changed Original file line number Diff line number Diff line change 55{
66 name ,
77 maintainers ,
8- url ? throw "default" ,
8+ url ? null ,
99 imports ? [ ] ,
1010 description ? null ,
1111 # deprecations
6262 luaConfigAtLocation = utils . mkConfigAt configLocation cfg . luaConfig . content ;
6363 in
6464 {
65- meta = {
66- inherit maintainers ;
67- nixvimInfo = {
68- inherit description ;
69- url = args . url or opts . package . default . meta . homepage ;
70- path = loc ;
71- } ;
72- } ;
73-
7465 options = lib . setAttrByPath loc (
7566 {
7667 enable = lib . mkEnableOption packPathName ;
168159 ++ [
169160 module
170161 ( utils . mkPluginPackageModule { inherit loc packPathName package ; } )
162+ ( utils . mkMetaModule {
163+ inherit
164+ loc
165+ maintainers
166+ description
167+ url
168+ ;
169+ } )
171170 ]
172171 ++ lib . optional deprecateExtraOptions (
173172 lib . mkRenamedOptionModule ( loc ++ [ "extraOptions" ] ) settingsPath
Original file line number Diff line number Diff line change 44} :
55{
66 name ,
7- url ? throw "default" ,
7+ url ? null ,
88 maintainers ,
99 imports ? [ ] ,
1010 description ? null ,
5555 opts = lib . getAttrFromPath loc options ;
5656 in
5757 {
58- meta = {
59- inherit maintainers ;
60- nixvimInfo = {
61- inherit description ;
62- url = args . url or opts . package . default . meta . homepage ;
63- path = loc ;
64- } ;
65- } ;
66-
6758 options = lib . setAttrByPath loc (
6859 {
6960 enable = lib . mkEnableOption packPathName ;
10091 ++ [
10192 module
10293 ( lib . nixvim . plugins . utils . mkPluginPackageModule { inherit loc packPathName package ; } )
94+ ( lib . nixvim . plugins . utils . mkMetaModule {
95+ inherit
96+ loc
97+ maintainers
98+ description
99+ url
100+ ;
101+ } )
103102 ]
104103 ++ lib . optional ( deprecateExtraConfig && createSettingsOption ) (
105104 lib . mkRenamedOptionModule ( loc ++ [ "extraConfig" ] ) settingsPath
Original file line number Diff line number Diff line change 8282 ] ;
8383 } ;
8484 } ;
85+
86+ /**
87+ Produce a module that defines a plugin's metadata.
88+ */
89+ mkMetaModule =
90+ {
91+ loc ,
92+ maintainers ,
93+ description ,
94+ url ? null ,
95+ } @args :
96+ { options , ... } :
97+ let
98+ opts = lib . getAttrFromPath loc options ;
99+ url =
100+ if args . url or null == null then
101+ opts . package . default . meta . homepage or ( throw "unable to get URL for `${ lib . showOption loc } `." )
102+ else
103+ args . url ;
104+ in
105+ {
106+ meta = {
107+ inherit maintainers ;
108+ nixvimInfo = {
109+ inherit description url ;
110+ path = loc ;
111+ } ;
112+ } ;
113+ } ;
85114}
You can’t perform that action at this time.
0 commit comments