From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: guix environment & PS1 Date: Wed, 01 Jul 2015 15:10:15 +0200 Message-ID: <87y4j0t45k.fsf@gnu.org> References: <1435182094-13537-1-git-send-email-tipecaml@gmail.com> <87fv5gj9je.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]:57468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZAHmV-00083p-AY for guix-devel@gnu.org; Wed, 01 Jul 2015 09:10:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZAHmR-0004km-AE for guix-devel@gnu.org; Wed, 01 Jul 2015 09:10:27 -0400 In-Reply-To: (David Thompson's message of "Thu, 25 Jun 2015 09:02:15 -0400") 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: "Thompson, David" Cc: guix-devel "Thompson, David" skribis: > On Thu, Jun 25, 2015 at 7:45 AM, Ludovic Court=C3=A8s wrot= e: >> Cyril Roelandt skribis: >> >>> +(define (run-shell shell env-name) >>> + "Run the given SHELL, adding '(ENV-NAME) ' at the start of the promp= t." >>> + (cond ((string=3D? shell "/bin/bash") >>> + (let* ((directory (or (getenv "TMPDIR") "/tmp")) >>> + (template (string-append directory "/guix-file.XXXXXX= ")) >>> + (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 u= nconditionally >> 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? Ludo=E2=80=99.