From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: guix environment & PS1 Date: Thu, 25 Jun 2015 13:45:57 +0200 Message-ID: <87fv5gj9je.fsf@gnu.org> References: <1435182094-13537-1-git-send-email-tipecaml@gmail.com> 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]:48402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z85bX-000350-Ht for guix-devel@gnu.org; Thu, 25 Jun 2015 07:46:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z85bU-0003Ik-69 for guix-devel@gnu.org; Thu, 25 Jun 2015 07:46:03 -0400 In-Reply-To: <1435182094-13537-1-git-send-email-tipecaml@gmail.com> (Cyril Roelandt's message of "Wed, 24 Jun 2015 23:41:34 +0200") 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: Cyril Roelandt Cc: guix-devel@gnu.org 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 unco= nditionally do: (setenv "GUIX_ENVIRONMENT" "t") and then users can choose in their .bashrc to use a separate PS1 when GUIX_ENVIRONMENT is defined. WDYT? Ludo=E2=80=99.