diff mbox

$HOME/.guix-profile considered harmful.

Message ID 1473704299-8703-1-git-send-email-jmd@gnu.org
State New
Headers show

Commit Message

John Darrington Sept. 12, 2016, 6:18 p.m. UTC
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(-)

Comments

Christopher Allan Webber Sept. 13, 2016, 1:32 a.m. UTC | #1
John Darrington writes:

> 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.

Hm, considered harmful, I dunno.  It seems a bit strong!  Something does
feel useful to me about having it in $HOME.  It seems like the logical
place to me, since it's per-user.

But I can see the merits of moving it to the %state-directory.
Eventually Debian + Guix stopped working with my GuixSD setup.  It might
have been nice to have a separate store location altogether.

Still, this switch feels very strange to me.  $HOME feels... like the
right thing.  Which I guess isn't a very good explaination.
Vincent Legoll Sept. 13, 2016, 8:35 a.m. UTC | #2
> Hm, considered harmful, I dunno.  It seems a bit strong!  Something does
> feel useful to me about having it in $HOME.  It seems like the logical
> place to me, since it's per-user.

It's a good thing for the user to have, but IMHO it's also a good thing that the
system do not rely on it being there, and only rely on %state-directory.

I think the patch is a good idea, but I wouldn't remove the $HOME/.guix-profile
symlink. So you keep the best of both worlds.

Just my uneducated 2cts feeling...
Ricardo Wurmus Sept. 13, 2016, 5:47 p.m. UTC | #3
John Darrington <jmd@gnu.org> writes:

> 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.

We use Guix on workstations and the cluster at the institute where I
work.  On the cluster /home is mounted via NFS.

Guix does not set PATH to $HOME/.guix-profile automatically.  Users have
to do this on their own.  (On GuixSD this is automatic.)

I find “$HOME/.guix-profile” very useful.  When set up it will always
point to the user’s current Guix profile on the machine.  If you want to
harmonize this across all machines then not only /home should be mounted
via NFS but also the store along with its localstatedir.  This is how
it’s done at the MDC, for example.

~~ Ricardo
Ludovic Courtès Sept. 13, 2016, 9:23 p.m. UTC | #4
Hello,

John Darrington <jmd@gnu.org> skribis:

> 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.

It’s true that %state-directory could differ on each machine.  I think
it’s uncommon though.

I understand your concern, but I agree with Ricardo that what you
suggest is not strictly required: commonly (my guess), people having
/home on NFS won’t have the problem you describe.

> I'm not sure exactly what benefit the ~/.guix-profile convention brings us, except
> perhaps that it is easy to remember.

… and easy to type, and quite “natural”.  These are the main reasons I
guess, but they’re quite important.

Thoughts?

Ludo’.
diff mbox

Patch

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.