unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: John Darrington <jmd@gnu.org>
To: guix-devel@gnu.org
Cc: John Darrington <jmd@gnu.org>
Subject: [PATCH] $HOME/.guix-profile considered harmful.
Date: Mon, 12 Sep 2016 20:18:19 +0200	[thread overview]
Message-ID: <1473704299-8703-1-git-send-email-jmd@gnu.org> (raw)

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 <ludo@gnu.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
+;;; Copyright © 2016 John Darrington <jmd@gnu.org>
 ;;;
 ;;; 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 <http://bugs.gnu.org/20255>.
-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.
-- 
2.1.4

             reply	other threads:[~2016-09-12 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 18:18 John Darrington [this message]
2016-09-13  1:32 ` [PATCH] $HOME/.guix-profile considered harmful Christopher Allan Webber
2016-09-13  8:35   ` Vincent Legoll
2016-09-13 17:47 ` Ricardo Wurmus
2016-09-13 21:23 ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473704299-8703-1-git-send-email-jmd@gnu.org \
    --to=jmd@gnu.org \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).