all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Andrew Tropin <andrew@trop.in>
Cc: 60365@debbugs.gnu.org
Subject: [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell
Date: Tue, 03 Jan 2023 23:46:53 +0100	[thread overview]
Message-ID: <878rij6xsy.fsf_-_@gnu.org> (raw)
In-Reply-To: <87v8lwf0vc.fsf@trop.in> (Andrew Tropin's message of "Wed, 28 Dec 2022 11:23:03 +0400")

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

Hi Andrew!

Andrew Tropin <andrew@trop.in> skribis:

>> I found some things could be improved in how we deal with ‘PS1’ in
>> Guix Home, Guix System, and ‘guix shell’ (my initial motivation was
>> making it easy to change ‘PS1’ from a Home configuration).
>>
>> These patches fiddle with ‘PS1’.  The most visible effect is that
>> Guix Home’s ~/.bashrc will no longer provide a default ‘PS1’.
>>
>> Thoughts?
>
> Factorization of bashrc is great!
>
> Not sure about moving PS1 to /etc/bashrc as it won't work on foreign
> distros and guix environment won't be noticable in the prompt.  Warning
> is useful, but I would expect prompt work OOB, when guix-defualts? is
> #t.

Yes, you’re right.

> The possible alternative solution is to factorize bash_profile and put
> PS1 here, so both skeleton and home provided bashrc have it, after that
> setting PS1 with environment-variables field will start working.

How about this:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 564 bytes --]

diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm
index d7dd579293..8d7db6b774 100644
--- a/gnu/home/services/shells.scm
+++ b/gnu/home/services/shells.scm
@@ -407,6 +407,9 @@ (define* (file-if-not-empty field #:optional (extra-content #f))
 # Honor per-interactive-shell startup file
 if [ -f ~/.bashrc ]; then source ~/.bashrc; fi
 "
+        (if (home-bash-configuration-guix-defaults? config)
+            "export PS1=...\n"
+            "")
         (serialize-field 'bash-profile)
         (serialize-field 'environment-variables)))
 

[-- Attachment #3: Type: text/plain, Size: 150 bytes --]


That way, if one adds ‘PS1’ to ‘environment-variables’, that will
override the default.

WDYT?

Thanks for your feedback!

Ludo’.

  reply	other threads:[~2023-01-03 22:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 21:23 [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Ludovic Courtès
2022-12-27 21:26 ` [bug#60365] [PATCH 1/4] system, home: Factorize default '.bashrc' Ludovic Courtès
2022-12-27 21:26   ` [bug#60365] [PATCH 2/4] system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc Ludovic Courtès
2022-12-27 21:26   ` [bug#60365] [PATCH 3/4] environment: Simplify 'PS1' suggestion on '--check' Ludovic Courtès
2022-12-27 21:26   ` [bug#60365] [PATCH 4/4] environment: Avoid false positive on 'PS1' check Ludovic Courtès
2022-12-28  7:23 ` [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Andrew Tropin
2023-01-03 22:46   ` Ludovic Courtès [this message]
2023-01-04  6:00     ` Andrew Tropin
2023-01-05 14:20       ` bug#60365: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rij6xsy.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=60365@debbugs.gnu.org \
    --cc=andrew@trop.in \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.