[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guix environment & PS1
From: |
Thompson, David |
Subject: |
Re: guix environment & PS1 |
Date: |
Wed, 1 Jul 2015 09:59:06 -0400 |
On Wed, Jul 1, 2015 at 9:10 AM, Ludovic Courtès <address@hidden> wrote:
> "Thompson, David" <address@hidden> skribis:
>
>> On Thu, Jun 25, 2015 at 7:45 AM, Ludovic Courtès <address@hidden> wrote:
>>> Cyril Roelandt <address@hidden> skribis:
>>>
>>>> +(define (run-shell shell env-name)
>>>> + "Run the given SHELL, adding '(ENV-NAME) ' at the start of the prompt."
>>>> + (cond ((string=? shell "/bin/bash")
>>>> + (let* ((directory (or (getenv "TMPDIR") "/tmp"))
>>>> + (template (string-append directory "/guix-file.XXXXXX"))
>>>> + (out (mkstemp! template)))
>>>> + (format out "export PS1=\"(~a) $PS1\"" env-name)
>>>> + (flush-output-port out)
>>>> + (system (string-append "/bin/bash --rcfile " template))))
>>>
>>> What about this simpler idea: ‘guix environment’ would unconditionally
>>> do:
>>>
>>> (setenv "GUIX_ENVIRONMENT" "t")
>>>
>>> and then users can choose in their .bashrc to use a separate PS1 when
>>> GUIX_ENVIRONMENT is defined.
>>>
>>> WDYT?
>>
>> +1
>>
>> This is much better.
>
> I’ve pushed something like that in ‘wip-environment’; comments welcome.
>
> I reckon it has the unfortunate property of not working out of the box
> (except on GuixSD.) I’m sure many tools these days would choose to
> hard-code a fancy colored PS1; while I prefer things that work out of
> the box, I’m not comfortable with hard-coding such things.
>
> Thoughts?
I agree with you. I'd rather not hard-code some fancy PS1.
- Dave