From: ludo@gnu.org (Ludovic Courtès)
To: Andreas Enge <andreas@enge.fr>
Cc: bug-guix@gnu.org
Subject: Re: Creating user profiles
Date: Sun, 13 Jan 2013 23:05:37 +0100 [thread overview]
Message-ID: <87libwrb66.fsf@gnu.org> (raw)
In-Reply-To: <201301131423.36130.andreas@enge.fr> (Andreas Enge's message of "Sun, 13 Jan 2013 14:23:36 +0100")
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
Hello!
Andreas Enge <andreas@enge.fr> skribis:
> I think the problem is that only the directory /usr/local/guix-
> git/var/nix/profiles exists, but that it is empty; maybe one should first
> create the directory $PREFIX/var/nix/profiles/per-user/$USER if it does not
> exist yet?
Right, good point. (Apparently Nix’s manual doesn’t mention it either.)
So here’s what I would do:
[-- Attachment #2: Type: text/x-patch, Size: 2695 bytes --]
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -233,6 +233,16 @@ The @code{guix-daemon} program may then be run as @code{root} with:
# guix-daemon --build-users-group=guix-builder
@end example
+In such a multi-user setup, @dfn{user profiles}---i.e., the set of
+user-installed packages as seen by @command{guix-package}
+(@pxref{Invoking guix-package})---must be stored in a place registered
+as a @dfn{garbage-collector root}. That directory is normally
+@code{@var{localstatedir}/profiles/per-user/@var{user}}, where
+@var{localstatedir} is the value passed to @code{configure} as
+@code{--localstatedir}, and @var{user} is the user name. This directory
+must be created by @code{root}, with @var{user} as the owner. When it
+does not exist, @command{guix-package} emits an error about it.
+
Guix may also be used in a single-user setup, with @command{guix-daemon}
running as a unprivileged user. However, to maximize non-interference
of build processes, the daemon still needs to perform certain operations
diff --git a/guix-package.in b/guix-package.in
index 450d09e..ec09cc4 100644
--- a/guix-package.in
+++ b/guix-package.in
@@ -36,6 +36,7 @@ exec ${GUILE-@GUILE@} -L "@guilemoduledir@" -l "$0" \
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix config)
+ #:use-module ((guix build utils) #:select (directory-exists?))
#:use-module (ice-9 ftw)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
@@ -465,6 +466,25 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n"))
(not (file-exists? %user-environment-directory)))
(symlink %current-profile %user-environment-directory))
+ ;; Attempt to create /…/profiles/per-user/$USER if needed.
+ (unless (or (not (equal? (assoc-ref opts 'profile) %current-profile))
+ (directory-exists? %profile-directory))
+ (catch 'system-error
+ (lambda ()
+ (mkdir %profile-directory))
+ (lambda args
+ ;; Often, we cannot create %PROFILE-DIRECTORY because its
+ ;; parent directory is root-owned and we're running
+ ;; unprivileged.
+ (format (current-error-port)
+ (_ "error: while creating directory `~a': ~a~%")
+ %profile-directory
+ (strerror (system-error-errno args)))
+ (format (current-error-port)
+ (_ "Please create the `~a' directory, with you as the owner.~%")
+ %profile-directory)
+ (exit 1))))
+
(with-error-handling
(or (process-query opts)
(parameterize ((%guile-for-build
[-- Attachment #3: Type: text/plain, Size: 30 bytes --]
WDYT?
Thanks,
Ludo’.
next prev parent reply other threads:[~2013-01-13 22:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-13 13:23 Creating user profiles Andreas Enge
2013-01-13 22:05 ` Ludovic Courtès [this message]
2013-01-13 22:31 ` Andreas Enge
2013-01-13 22:45 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87libwrb66.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=andreas@enge.fr \
--cc=bug-guix@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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.