From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Thompson, David" Subject: Re: guix environment & PS1 Date: Thu, 25 Jun 2015 09:02:15 -0400 Message-ID: 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]:44141) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86nO-0007LF-Ng for guix-devel@gnu.org; Thu, 25 Jun 2015 09:02:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z86nI-000348-JY for guix-devel@gnu.org; Thu, 25 Jun 2015 09:02:22 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z86nI-00033c-Ey for guix-devel@gnu.org; Thu, 25 Jun 2015 09:02:16 -0400 Received: by pdbep18 with SMTP id ep18so31363565pdb.1 for ; Thu, 25 Jun 2015 06:02:15 -0700 (PDT) In-Reply-To: <87fv5gj9je.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 Thu, Jun 25, 2015 at 7:45 AM, Ludovic Court=C3=A8s wrote: > Cyril Roelandt skribis: > >> +(define (run-shell shell env-name) >> + "Run the given SHELL, adding '(ENV-NAME) ' at the start of the prompt= ." >> + (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 un= conditionally > 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. - Dave