From patchwork Mon Sep 12 18:18:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Darrington X-Patchwork-Id: 15540 Received: (qmail 108882 invoked by uid 89); 12 Sep 2016 18:18:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=Startup, peruser, per-user, $path X-Spam-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: lists.gnu.org Received: from lists.gnu.org (HELO lists.gnu.org) (208.118.235.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 12 Sep 2016 18:18:40 +0000 Received: from localhost ([::1]:44509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjVoU-0006L8-Q5 for patchwork@sourceware.org; Mon, 12 Sep 2016 14:18:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjVoP-0006Kr-59 for guix-devel@gnu.org; Mon, 12 Sep 2016 14:18:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjVoL-0003Ew-03 for guix-devel@gnu.org; Mon, 12 Sep 2016 14:18:33 -0400 Received: from de.cellform.com ([88.217.224.109]:55574 helo=jocasta.intra) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjVoK-0003El-Ne; Mon, 12 Sep 2016 14:18:28 -0400 Received: from jocasta.intra (localhost [127.0.0.1]) by jocasta.intra (8.14.4/8.14.4/Debian-8) with ESMTP id u8CIIRqx008749 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 12 Sep 2016 20:18:27 +0200 Received: (from john@localhost) by jocasta.intra (8.14.4/8.14.4/Submit) id u8CIIQZJ008748; Mon, 12 Sep 2016 20:18:26 +0200 From: John Darrington To: guix-devel@gnu.org Subject: [PATCH] $HOME/.guix-profile considered harmful. Date: Mon, 12 Sep 2016 20:18:19 +0200 Message-Id: <1473704299-8703-1-git-send-email-jmd@gnu.org> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by jocasta.intra id u8CIIRqx008749 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 88.217.224.109 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Darrington Errors-To: guix-devel-bounces+patchwork=sourceware.org@gnu.org Sender: "Guix-devel" I have my /home NFS mounted (not uncommon in large networks, I think). Unfortunately this does not play nicely with guix's convention of setting $PATH &c to $HOME/.guix-profile and then linking $HOME/.guix-profile to %state-directory/profiles/per-user/$USER/guix_profile - for the obvious reason that %state-directory could be different on each workstation - in which case $HOME/.guix-profile will be a dead link. I'm not sure exactly what benefit the ~/.guix-profile convention brings us, except perhaps that it is easy to remember. I'd like to see the ability to have GuixSD deployable in medium-large intranets where home (and /var/mail) are remotely mounted filesystems. Hence I suggest that $HOME/.guix-profile is deprecated. The following patch fixes part of the problem on my system. --- gnu/system.scm | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gnu/system.scm b/gnu/system.scm index 7edb018..dbdb2f6 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost +;;; Copyright © 2016 John Darrington ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,6 +27,7 @@ #:use-module (guix packages) #:use-module (guix derivations) #:use-module (guix profiles) + #:use-module (guix config) #:use-module (guix ui) #:use-module (gnu packages base) #:use-module (gnu packages bash) @@ -405,14 +407,15 @@ directory." ;; Startup file for POSIX-compliant login shells, which set system-wide ;; environment variables. - (profile (mixed-text-file "profile" "\ + (profile (mixed-text-file "profile" (format #f "\ # Crucial variables that could be missing in the profiles' 'etc/profile' # because they would require combining both profiles. # FIXME: See . -export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man -export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info -export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share -export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg +guix_profile=~a/profiles/per-user/$USER/guix-profile +export MANPATH=$guix_profile/share/man:/run/current-system/profile/share/man +export INFOPATH=$guix_profile/share/info:/run/current-system/profile/share/info +export XDG_DATA_DIRS=$guix_profile/share:/run/current-system/profile/share +export XDG_CONFIG_DIRS=$guix_profile/etc/xdg:/run/current-system/profile/etc/xdg # Ignore the default value of 'PATH'. unset PATH @@ -435,15 +438,15 @@ then export `cat /etc/environment | cut -d= -f1` fi -if [ -f \"$HOME/.guix-profile/etc/profile\" ] +if [ -f \"$guix_profile/etc/profile\" ] then # Load the user profile's settings. - GUIX_PROFILE=\"$HOME/.guix-profile\" \\ - . \"$HOME/.guix-profile/etc/profile\" + GUIX_PROFILE=\"$guix_profile\" \\ + . \"$guix_profile/etc/profile\" else # At least define this one so that basic things just work # when the user installs their first package. - export PATH=\"$HOME/.guix-profile/bin:$PATH\" + export PATH=\"$guix_profile/bin:$PATH\" fi # Set the umask, notably for users logging in via 'lsh'. @@ -451,14 +454,14 @@ fi umask 022 # Allow GStreamer-based applications to find plugins. -export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\" +export GST_PLUGIN_PATH=\"$guix_profile/lib/gstreamer-1.0\" if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ] then # Load Bash-specific initialization code. . /etc/bashrc fi -")) +" %state-directory))) (bashrc (plain-file "bashrc" "\ # Bash-specific initialization.