unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] $HOME/.guix-profile considered harmful.
@ 2016-09-12 18:18 John Darrington
  2016-09-13  1:32 ` Christopher Allan Webber
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: John Darrington @ 2016-09-12 18:18 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] $HOME/.guix-profile considered harmful.
  2016-09-12 18:18 [PATCH] $HOME/.guix-profile considered harmful John Darrington
@ 2016-09-13  1:32 ` 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
  2 siblings, 1 reply; 5+ messages in thread
From: Christopher Allan Webber @ 2016-09-13  1:32 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] $HOME/.guix-profile considered harmful.
  2016-09-13  1:32 ` Christopher Allan Webber
@ 2016-09-13  8:35   ` Vincent Legoll
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Legoll @ 2016-09-13  8:35 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: guix-devel, John Darrington

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

-- 
Vincent Legoll

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] $HOME/.guix-profile considered harmful.
  2016-09-12 18:18 [PATCH] $HOME/.guix-profile considered harmful John Darrington
  2016-09-13  1:32 ` Christopher Allan Webber
@ 2016-09-13 17:47 ` Ricardo Wurmus
  2016-09-13 21:23 ` Ludovic Courtès
  2 siblings, 0 replies; 5+ messages in thread
From: Ricardo Wurmus @ 2016-09-13 17:47 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] $HOME/.guix-profile considered harmful.
  2016-09-12 18:18 [PATCH] $HOME/.guix-profile considered harmful John Darrington
  2016-09-13  1:32 ` Christopher Allan Webber
  2016-09-13 17:47 ` Ricardo Wurmus
@ 2016-09-13 21:23 ` Ludovic Courtès
  2 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2016-09-13 21:23 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-09-13 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-12 18:18 [PATCH] $HOME/.guix-profile considered harmful John Darrington
2016-09-13  1:32 ` 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

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