Skip to content

Commit 5419dc1

Browse files
committed
devshell: support overriding devshell.interactive.PS1
Not ideal, but now it's possible to do something like that: [devshell.interactive.PS1] text = "PS1='hello $ '"
1 parent 288b4bd commit 5419dc1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

modules/devshell.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@ in
245245
};
246246

247247
interactive = {
248-
PS1 = noDepEntry ''
249-
# Set a cool PS1
248+
PS1_util = noDepEntry ''
250249
if [[ -n "''${DEVSHELL_ROOT:-}" ]]; then
251250
# Print the path relative to $DEVSHELL_ROOT
252251
rel_root() {
@@ -262,8 +261,12 @@ in
262261
echo " \W "
263262
}
264263
fi
265-
PS1='\[\033[38;5;202m\][${cfg.name}]$(rel_root)\$\[\033[0m\] '
266264
'';
265+
266+
# Set a cool PS1
267+
PS1 = stringAfter [ "PS1_util" ] (lib.mkDefault ''
268+
PS1='\[\033[38;5;202m\][${cfg.name}]$(rel_root)\$\[\033[0m\] '
269+
'');
267270
};
268271

269272
# Use a naked derivation to limit the amount of noise passed to nix-shell.

0 commit comments

Comments
 (0)