Add (nix:$name) as a prefix to the bash prompt (#191)

* Add `(nix)` as a prefix to the bash prompt

Make it clearer when you're in the terminal vs. not.

* bash prompt prefix: put the project's name in the terminal

* Blame our installer for the nix.conf

* fixup: adding the version to the nix.conf

* force a space after the prefix
This commit is contained in:
Graham Christensen 2023-01-18 15:11:05 +00:00 committed by GitHub
parent 9b27fe35a5
commit b3b168e32c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,8 @@ impl PlaceNixConfiguration {
) -> Result<StatefulAction<Self>, ActionError> {
let buf = format!(
"\
# Generated by https://github.com/DeterminateSystems/nix-installer, version {version}.\n\
\n\
{extra_conf}\n\
\n\
build-users-group = {nix_build_group_name}\n\
@ -31,8 +33,11 @@ impl PlaceNixConfiguration {
experimental-features = nix-command flakes\n\
\n\
auto-optimise-store = true\n\
\n\
bash-prompt-prefix = (nix:$name)\\040\n\
",
extra_conf = extra_conf.join("\n"),
version = env!("CARGO_PKG_VERSION"),
);
let create_directory =
CreateDirectory::plan(NIX_CONF_FOLDER, None, None, 0o0755, force).await?;