Message ID | 878rij6xsy.fsf_-_@gnu.org |
---|---|
State | New |
Headers |
Return-Path: <guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org> X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 80A3027BBEB; Tue, 3 Jan 2023 22:48:29 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E410E27BBE9 for <patchwork@mira.cbaines.net>; Tue, 3 Jan 2023 22:48:23 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <guix-patches-bounces@gnu.org>) id 1pCq4i-0001y6-7w; Tue, 03 Jan 2023 17:48:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pCq4g-0001xo-I4 for guix-patches@gnu.org; Tue, 03 Jan 2023 17:48:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pCq4g-0002t1-9M for guix-patches@gnu.org; Tue, 03 Jan 2023 17:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1pCq4g-0004fX-2c for guix-patches@gnu.org; Tue, 03 Jan 2023 17:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#60365] [PATCH 0/4] Rationalize 'PS1' handling in home, system, and shell Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org> Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 Jan 2023 22:48:02 +0000 Resent-Message-ID: <handler.60365.B60365.167278602517740@debbugs.gnu.org> Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60365 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Andrew Tropin <andrew@trop.in> Cc: 60365@debbugs.gnu.org Received: via spool by 60365-submit@debbugs.gnu.org id=B60365.167278602517740 (code B ref 60365); Tue, 03 Jan 2023 22:48:02 +0000 Received: (at 60365) by debbugs.gnu.org; 3 Jan 2023 22:47:05 +0000 Received: from localhost ([127.0.0.1]:47037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>) id 1pCq3l-0004c4-Gx for submit@debbugs.gnu.org; Tue, 03 Jan 2023 17:47:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35176) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <ludo@gnu.org>) id 1pCq3j-0004b9-05 for 60365@debbugs.gnu.org; Tue, 03 Jan 2023 17:47:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1pCq3d-0002lC-IC; Tue, 03 Jan 2023 17:46:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=hWlmL8DdtWYtUrdJeGPBS4d00bfXIELki8q5/CdRgiI=; b=ZD6w05YVpkxj9Ugre0IX 0dr+EPcfwcdGGevJ/fC0olDqf1vKjQHRC8SvHkaBpWbMOS/r5Xco67daf7y9mevvjJlgXcYUeJub9 2WBF6Y8cDXQGO+UIW1TI99PLHOJvYtZwO0TmRO4/gHIP7KR1NtOSRPJlk6K0rB59B/7tNTKrK6mvw e2eX148LQPzQWUJjd0EFFNQ909wjopDok74V+1yycc6fMuFf0+Juc4VRVwYzVXh5WKREl/r5qwR1R tkLOyUjAIGlSOKgE4hQol8mF1e7bnhan8+xXY8vi/ryZRzmvBMBgUDWSry4VgCxdfrlFn5wZ24w8l JcNK5QOsX0F0nQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <ludo@gnu.org>) id 1pCq3b-0006Xt-SM; Tue, 03 Jan 2023 17:46:57 -0500 From: Ludovic =?utf-8?q?Court=C3=A8s?= <ludo@gnu.org> References: <20221227212342.17939-1-ludo@gnu.org> <87v8lwf0vc.fsf@trop.in> Date: Tue, 03 Jan 2023 23:46:53 +0100 In-Reply-To: <87v8lwf0vc.fsf@trop.in> (Andrew Tropin's message of "Wed, 28 Dec 2022 11:23:03 +0400") Message-ID: <878rij6xsy.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: <guix-patches.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=unsubscribe> List-Archive: <https://lists.gnu.org/archive/html/guix-patches> List-Post: <mailto:guix-patches@gnu.org> List-Help: <mailto:guix-patches-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>, <mailto:guix-patches-request@gnu.org?subject=subscribe> Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches |
Commit Message
Ludovic Courtès
Jan. 3, 2023, 10:46 p.m. UTC
Hi Andrew! Andrew Tropin <andrew@trop.in> skribis: >> I found some things could be improved in how we deal with ‘PS1’ in >> Guix Home, Guix System, and ‘guix shell’ (my initial motivation was >> making it easy to change ‘PS1’ from a Home configuration). >> >> These patches fiddle with ‘PS1’. The most visible effect is that >> Guix Home’s ~/.bashrc will no longer provide a default ‘PS1’. >> >> Thoughts? > > Factorization of bashrc is great! > > Not sure about moving PS1 to /etc/bashrc as it won't work on foreign > distros and guix environment won't be noticable in the prompt. Warning > is useful, but I would expect prompt work OOB, when guix-defualts? is > #t. Yes, you’re right. > The possible alternative solution is to factorize bash_profile and put > PS1 here, so both skeleton and home provided bashrc have it, after that > setting PS1 with environment-variables field will start working. How about this: That way, if one adds ‘PS1’ to ‘environment-variables’, that will override the default. WDYT? Thanks for your feedback! Ludo’.
Comments
On 2023-01-03 23:46, Ludovic Courtès wrote: > Hi Andrew! > > Andrew Tropin <andrew@trop.in> skribis: > >>> I found some things could be improved in how we deal with ‘PS1’ in >>> Guix Home, Guix System, and ‘guix shell’ (my initial motivation was >>> making it easy to change ‘PS1’ from a Home configuration). >>> >>> These patches fiddle with ‘PS1’. The most visible effect is that >>> Guix Home’s ~/.bashrc will no longer provide a default ‘PS1’. >>> >>> Thoughts? >> >> Factorization of bashrc is great! >> >> Not sure about moving PS1 to /etc/bashrc as it won't work on foreign >> distros and guix environment won't be noticable in the prompt. Warning >> is useful, but I would expect prompt work OOB, when guix-defualts? is >> #t. > > Yes, you’re right. > >> The possible alternative solution is to factorize bash_profile and put >> PS1 here, so both skeleton and home provided bashrc have it, after that >> setting PS1 with environment-variables field will start working. > > How about this: > > diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm > index d7dd579293..8d7db6b774 100644 > --- a/gnu/home/services/shells.scm > +++ b/gnu/home/services/shells.scm > @@ -407,6 +407,9 @@ (define* (file-if-not-empty field #:optional (extra-content #f)) > # Honor per-interactive-shell startup file > if [ -f ~/.bashrc ]; then source ~/.bashrc; fi > " > + (if (home-bash-configuration-guix-defaults? config) > + "export PS1=...\n" Yep, something like that should work. Ideally, is to make %default-bash-profile or even more generic %default-profile and reuse it across system and home, but it may be not that trivial, so we can postpone it for now. > + "") > (serialize-field 'bash-profile) > (serialize-field 'environment-variables))) > > > That way, if one adds ‘PS1’ to ‘environment-variables’, that will > override the default. > > WDYT? > > Thanks for your feedback! > > Ludo’.
Andrew Tropin <andrew@trop.in> skribis: > On 2023-01-03 23:46, Ludovic Courtès wrote: [...] >>> Not sure about moving PS1 to /etc/bashrc as it won't work on foreign >>> distros and guix environment won't be noticable in the prompt. Warning >>> is useful, but I would expect prompt work OOB, when guix-defualts? is >>> #t. >> >> Yes, you’re right. >> >>> The possible alternative solution is to factorize bash_profile and put >>> PS1 here, so both skeleton and home provided bashrc have it, after that >>> setting PS1 with environment-variables field will start working. >> >> How about this: >> >> diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm >> index d7dd579293..8d7db6b774 100644 >> --- a/gnu/home/services/shells.scm >> +++ b/gnu/home/services/shells.scm >> @@ -407,6 +407,9 @@ (define* (file-if-not-empty field #:optional (extra-content #f)) >> # Honor per-interactive-shell startup file >> if [ -f ~/.bashrc ]; then source ~/.bashrc; fi >> " >> + (if (home-bash-configuration-guix-defaults? config) >> + "export PS1=...\n" > > Yep, something like that should work. Ideally, is to make > %default-bash-profile or even more generic %default-profile and reuse it > across system and home, but it may be not that trivial, so we can > postpone it for now. I adjusted things as proposed and pushed: b5e3701f1a environment: Avoid false positive on 'PS1' check. 632e2f7ce1 environment: Simplify 'PS1' suggestion on '--check'. 086df6ef21 system: Define default 'PS1' in /etc/bashrc rather than ~/.bashrc. 2127e56bd8 system, home: Factorize default '.bashrc'. Thanks! Ludo’.
diff --git a/gnu/home/services/shells.scm b/gnu/home/services/shells.scm index d7dd579293..8d7db6b774 100644 --- a/gnu/home/services/shells.scm +++ b/gnu/home/services/shells.scm @@ -407,6 +407,9 @@ (define* (file-if-not-empty field #:optional (extra-content #f)) # Honor per-interactive-shell startup file if [ -f ~/.bashrc ]; then source ~/.bashrc; fi " + (if (home-bash-configuration-guix-defaults? config) + "export PS1=...\n" + "") (serialize-field 'bash-profile) (serialize-field 'environment-variables)))