summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-12-14 18:15:37 +0100
committerLudovic Courtès <ludo@gnu.org>2012-12-14 18:15:37 +0100
commite1b7096acdd3dedbdca92a6d20ade94b21d8561d (patch)
treefb72d4fb70e265033bd66793446c1af9f0cd969d
parentb3a53fb3610ff23b75f11d58325110d29451a726 (diff)
daemon: Build `nix-setuid-helper'.
* daemon.am (libexec_PROGRAMS, nix_setuid_helper_SOURCES, nix_setuid_helper_CPPFLAGS, nix_setuid_helper_LDADD): New variables. * test-env.in: Set and export `NIX_SETUID_HELPER'. * README (Installing Guix as non-root): New section.
-rw-r--r--.gitignore1
-rw-r--r--README27
-rw-r--r--daemon.am10
-rw-r--r--test-env.in3
4 files changed, 36 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 8f224467c9c..b6786d212b5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,3 +63,4 @@ stamp-h[0-9]
63/test-tmp 63/test-tmp
64/nix/scripts/list-runtime-roots 64/nix/scripts/list-runtime-roots
65/test-env 65/test-env
66/nix/nix-setuid-helper/nix-setuid-helper.cc
diff --git a/README b/README
index d2bbfacd5ae..09433586bec 100644
--- a/README
+++ b/README
@@ -59,10 +59,29 @@ the promise of a build; it is stored as a text file under
59`derivation' primitive, as well as higher-level wrappers such as 59`derivation' primitive, as well as higher-level wrappers such as
60`build-expression->derivation'. 60`build-expression->derivation'.
61 61
62Guix does remote procedure calls (RPCs) to the Nix daemon (the 62Guix does remote procedure calls (RPCs) to the Guix or Nix daemon (the
63=nix-worker --daemon= command), which in turn performs builds and 63=guix-daemon= or =nix-daemon= command), which in turn performs builds
64accesses to the Nix store on its behalf. The RPCs are implemented in 64and accesses to the Nix store on its behalf. The RPCs are implemented
65the (guix store) module. 65in the (guix store) module.
66
67* Installing Guix as non-root
68
69The Guix daemon allows software builds to be performed under alternate
70user accounts, which are normally created specifically for this
71purpose. For instance, you may have a pool of accounts in the
72=guixbuild= group, and then you can instruct =guix-daemon= to use them
73like this:
74
75 $ guix-daemon --build-users-group=guixbuild
76
77However, unless it is run as root, =guix-daemon= cannot switch users.
78In that case, it falls back to using a setuid-root helper program call
79=nix-setuid-helper=. That program is not setuid-root by default when
80you install it; instead you should run a command along these lines
81(assuming Guix is installed under /usr/local):
82
83 # chown root.root /usr/local/libexec/nix-setuid-helper
84 # chmod 4755 /usr/local/libexec/nix-setuid-helper
66 85
67* Contact 86* Contact
68 87
diff --git a/daemon.am b/daemon.am
index aa75c6ed298..26b07c41050 100644
--- a/daemon.am
+++ b/daemon.am
@@ -136,6 +136,16 @@ guix_daemon_LDADD = \
136guix_daemon_headers = \ 136guix_daemon_headers = \
137 nix/nix-daemon/shared.hh 137 nix/nix-daemon/shared.hh
138 138
139libexec_PROGRAMS = nix-setuid-helper
140nix_setuid_helper_SOURCES = \
141 nix/nix-setuid-helper/nix-setuid-helper.cc
142
143nix_setuid_helper_CPPFLAGS = \
144 $(libutil_a_CPPFLAGS)
145
146nix_setuid_helper_LDADD = \
147 libutil.a libformat.a
148
139noinst_HEADERS = \ 149noinst_HEADERS = \
140 $(libformat_headers) $(libutil_headers) $(libstore_headers) \ 150 $(libformat_headers) $(libutil_headers) $(libstore_headers) \
141 $(guix_daemon_headers) 151 $(guix_daemon_headers)
diff --git a/test-env.in b/test-env.in
index 4e388053f93..afcf3afedcb 100644
--- a/test-env.in
+++ b/test-env.in
@@ -27,6 +27,7 @@
27if [ -x "@abs_top_builddir@/guix-daemon" ] 27if [ -x "@abs_top_builddir@/guix-daemon" ]
28then 28then
29 NIX_SUBSTITUTERS="" # don't resort to substituters 29 NIX_SUBSTITUTERS="" # don't resort to substituters
30 NIX_SETUID_HELPER="@abs_top_builddir@/nix-setuid-helper" # normally unused
30 NIX_IGNORE_SYMLINK_STORE=1 # in case the store is a symlink 31 NIX_IGNORE_SYMLINK_STORE=1 # in case the store is a symlink
31 NIX_STORE_DIR="@GUIX_TEST_ROOT@/store" 32 NIX_STORE_DIR="@GUIX_TEST_ROOT@/store"
32 NIX_LOCALSTATE_DIR="@GUIX_TEST_ROOT@/var" 33 NIX_LOCALSTATE_DIR="@GUIX_TEST_ROOT@/var"
@@ -42,7 +43,7 @@ then
42 43
43 export NIX_SUBSTITUTERS NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR \ 44 export NIX_SUBSTITUTERS NIX_IGNORE_SYMLINK_STORE NIX_STORE_DIR \
44 NIX_LOCALSTATE_DIR NIX_LOG_DIR NIX_STATE_DIR NIX_DB_DIR \ 45 NIX_LOCALSTATE_DIR NIX_LOG_DIR NIX_STATE_DIR NIX_DB_DIR \
45 NIX_ROOT_FINDER 46 NIX_ROOT_FINDER NIX_SETUID_HELPER
46 47
47 # Do that because store.scm calls `canonicalize-path' on it. 48 # Do that because store.scm calls `canonicalize-path' on it.
48 mkdir -p "$NIX_STORE_DIR" 49 mkdir -p "$NIX_STORE_DIR"