File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 178178 help = "prints this menu" ;
179179 name = "menu" ;
180180 command = ''
181- cat <<'DEVSHELL_MENU'
181+ cat <<${ ( x : if config . devshell . menu . interpolate then x else "' ${ x } '" ) "DEVSHELL_MENU" }
182182 ${ commandsToMenu config . commands }
183183 DEVSHELL_MENU
184184 '' ;
Original file line number Diff line number Diff line change 345345 options list (except that the 'name' field is ignored).
346346 '' ;
347347 } ;
348+
349+ menu = mkOption {
350+ type = types . submodule {
351+ options . interpolate = mkEnableOption "interpolation in the devshell menu" ;
352+ } ;
353+ default = { } ;
354+ description = ''
355+ Controls devshell menu
356+ '' ;
357+ example = literalExpression ''
358+ {
359+ interpolate = true;
360+ }
361+ '' ;
362+ } ;
348363 } ;
349364
350365 config . devshell = {
Original file line number Diff line number Diff line change 1+ { pkgs , devshell , runTest } :
2+ {
3+ interpolate =
4+ let
5+ shell = devshell . mkShell {
6+ devshell . menu . interpolate = true ;
7+ commands = [
8+ { package = "hello" ; help = "start at $PRJ_ROOT" ; }
9+ { package = "jq" ; help = ''jq from '\$PRJ_ROOT'!'' ; }
10+ ] ;
11+ } ;
12+ in
13+ runTest "interpolate" { } ''
14+ # Check interpolation is enabled
15+ cat ${ shell } /bin/menu | grep '<<DEVSHELL_MENU'
16+
17+ # Check escaped variable
18+ eval ${ shell } /bin/menu | grep '\$PRJ_ROOT'
19+ '' ;
20+ }
You can’t perform that action at this time.
0 commit comments