From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: guix environment & PS1 Date: Wed, 1 Jul 2015 09:59:06 -0400 Message-ID: References: <1435182094-13537-1-git-send-email-tipecaml@gmail.com> <87fv5gj9je.fsf@gnu.org> <87y4j0t45k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46374) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAIXh-0003og-VJ for guix-devel@gnu.org; Wed, 01 Jul 2015 09:59:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAIXb-0002uS-NH for guix-devel@gnu.org; Wed, 01 Jul 2015 09:59:13 -0400 Received: from mail-lb0-f171.google.com ([209.85.217.171]:35467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAIXb-0002u0-Go for guix-devel@gnu.org; Wed, 01 Jul 2015 09:59:07 -0400 Received: by lbcpe5 with SMTP id pe5so13414462lbc.2 for ; Wed, 01 Jul 2015 06:59:06 -0700 (PDT) In-Reply-To: <87y4j0t45k.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: guix-devel On Wed, Jul 1, 2015 at 9:10 AM, Ludovic Court=C3=A8s wrote: > "Thompson, David" skribis: > >> On Thu, Jun 25, 2015 at 7:45 AM, Ludovic Court=C3=A8s wro= te: >>> Cyril Roelandt skribis: >>> >>>> +(define (run-shell shell env-name) >>>> + "Run the given SHELL, adding '(ENV-NAME) ' at the start of the prom= pt." >>>> + (cond ((string=3D? shell "/bin/bash") >>>> + (let* ((directory (or (getenv "TMPDIR") "/tmp")) >>>> + (template (string-append directory "/guix-file.XXXXX= X")) >>>> + (out (mkstemp! template))) >>>> + (format out "export PS1=3D\"(~a) $PS1\"" env-name) >>>> + (flush-output-port out) >>>> + (system (string-append "/bin/bash --rcfile " template)))) >>> >>> What about this simpler idea: =E2=80=98guix environment=E2=80=99 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=E2=80=99ve pushed something like that in =E2=80=98wip-environment=E2=80= =99; comments welcome. > > I reckon it has the unfortunate property of not working out of the box > (except on GuixSD.) I=E2=80=99m 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=E2=80=99m not comfortable with hard-coding such things. > > Thoughts? I agree with you. I'd rather not hard-code some fancy PS1. - Dave