aboutsummaryrefslogtreecommitdiff
path: root/src/nix/develop.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-05-13 14:06:07 +0200
committerGitHub <noreply@github.com>2022-05-13 14:06:07 +0200
commitbf89cd95a4af35ab15f7fad3186c8f6190f87c84 (patch)
treee2d57c36ad0b53d6fa359b8b4c2dc81233740c39 /src/nix/develop.cc
parentd354fc30b9768ea3dc737a88b57bf5e26d98135b (diff)
parent584475acf9f4b8eda2a451901f6f9af35ae976e0 (diff)
Merge pull request #6525 from J-Swift/feature/bash-prefix
Add `bash-prompt-prefix` option
Diffstat (limited to 'src/nix/develop.cc')
-rw-r--r--src/nix/develop.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 3a99fff6f..2a3fc0213 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -18,6 +18,9 @@ struct DevelopSettings : Config
Setting<std::string> bashPrompt{this, "", "bash-prompt",
"The bash prompt (`PS1`) in `nix develop` shells."};
+ Setting<std::string> bashPromptPrefix{this, "", "bash-prompt-prefix",
+ "Prefix prepended to the `PS1` environment variable in `nix develop` shells."};
+
Setting<std::string> bashPromptSuffix{this, "", "bash-prompt-suffix",
"Suffix appended to the `PS1` environment variable in `nix develop` shells."};
};
@@ -482,6 +485,9 @@ struct CmdDevelop : Common, MixEnvironment
if (developSettings.bashPrompt != "")
script += fmt("[ -n \"$PS1\" ] && PS1=%s;\n",
shellEscape(developSettings.bashPrompt.get()));
+ if (developSettings.bashPromptPrefix != "")
+ script += fmt("[ -n \"$PS1\" ] && PS1=%s\"$PS1\";\n",
+ shellEscape(developSettings.bashPromptPrefix.get()));
if (developSettings.bashPromptSuffix != "")
script += fmt("[ -n \"$PS1\" ] && PS1+=%s;\n",
shellEscape(developSettings.bashPromptSuffix.get()));