File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 33command = " genemichaels"
44excludes = []
55includes = [" *.rs" ]
6- options = [" --config " , " genemichaels.json " ]
6+ options = []
Original file line number Diff line number Diff line change 77} :
88let
99 cfg = config . programs . genemichaels ;
10+ opt = options . programs . genemichaels ;
1011 configFormat = pkgs . formats . json { } ;
1112
1213 inherit ( lib )
123124
124125 settingsFile = mkOption {
125126 description = "The configuration file used by `genemichaels`." ;
126- type = types . path ;
127+ type = types . nullOr types . path ;
127128 example = lib . literalExpression ''./.genemichaels.json'' ;
128- default = configFormat . generate ".genemichaels.json" cfg . settings ;
129- defaultText = lib . literalMD "Generated JSON file from `${ showOptionParent options . programs . genemichaels . settings . max_width 1 } `" ;
129+ default =
130+ let
131+ settings = lib . filterAttrs ( key : value : value != opt . settings . ${ key } . default ) cfg . settings ;
132+ in
133+ if settings != { } then configFormat . generate ".genemichaels.json" settings else null ;
134+ defaultText = lib . literalMD "Generated JSON file from `${ showOptionParent opt . settings . max_width 1 } `" ;
130135 } ;
131136
132137 threadCount = mkOption {
166171 "--thread-count"
167172 ( toString cfg . threadCount )
168173 ] )
169- ++ [
174+ ++ ( optionals ( cfg . settingsFile != null ) [
170175 "--config"
171176 ( toString cfg . settingsFile )
172- ] ;
177+ ] ) ;
173178 includes = cfg . includes ;
174179 excludes = cfg . excludes ;
175180 } ;
You can’t perform that action at this time.
0 commit comments