aboutsummaryrefslogtreecommitdiff
path: root/src/nix/develop.cc
diff options
context:
space:
mode:
authorJimmy Reichley <jimmyqpublik@gmail.com>2022-05-10 16:53:22 -0400
committerJimmy Reichley <jimmyqpublik@gmail.com>2022-05-10 16:53:22 -0400
commit2998527b185a41157be6ead42fd03a66601c4f56 (patch)
treed82a7baa99216e82f5ff8d86a211499e32be600d /src/nix/develop.cc
parenteb957ad6d8f7375e9b78f4b3696912dded95f7a6 (diff)
Allow setting bash-prompt-prefix nix develop configuration
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()));