guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] $HOME/.guix-profile considered harmful.


From: John Darrington
Subject: [PATCH] $HOME/.guix-profile considered harmful.
Date: Mon, 12 Sep 2016 20:18:19 +0200

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 <address@hidden>
 ;;; Copyright © 2015 Mark H Weaver <address@hidden>
 ;;; Copyright © 2015, 2016 Alex Kost <address@hidden>
+;;; Copyright © 2016 John Darrington <address@hidden>
 ;;;
 ;;; 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 via email to

[Prev in Thread] Current Thread [Next in Thread]