diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2012-12-14 18:15:37 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2012-12-14 18:15:37 +0100 |
| commit | e1b7096acdd3dedbdca92a6d20ade94b21d8561d (patch) | |
| tree | fb72d4fb70e265033bd66793446c1af9f0cd969d | |
| parent | b3a53fb3610ff23b75f11d58325110d29451a726 (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-- | .gitignore | 1 | ||||
| -rw-r--r-- | README | 27 | ||||
| -rw-r--r-- | daemon.am | 10 | ||||
| -rw-r--r-- | test-env.in | 3 |
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 | ||
| @@ -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 | ||
| 62 | Guix does remote procedure calls (RPCs) to the Nix daemon (the | 62 | Guix 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 |
| 64 | accesses to the Nix store on its behalf. The RPCs are implemented in | 64 | and accesses to the Nix store on its behalf. The RPCs are implemented |
| 65 | the (guix store) module. | 65 | in the (guix store) module. |
| 66 | |||
| 67 | * Installing Guix as non-root | ||
| 68 | |||
| 69 | The Guix daemon allows software builds to be performed under alternate | ||
| 70 | user accounts, which are normally created specifically for this | ||
| 71 | purpose. For instance, you may have a pool of accounts in the | ||
| 72 | =guixbuild= group, and then you can instruct =guix-daemon= to use them | ||
| 73 | like this: | ||
| 74 | |||
| 75 | $ guix-daemon --build-users-group=guixbuild | ||
| 76 | |||
| 77 | However, unless it is run as root, =guix-daemon= cannot switch users. | ||
| 78 | In 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 | ||
| 80 | you 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 | ||
| @@ -136,6 +136,16 @@ guix_daemon_LDADD = \ | |||
| 136 | guix_daemon_headers = \ | 136 | guix_daemon_headers = \ |
| 137 | nix/nix-daemon/shared.hh | 137 | nix/nix-daemon/shared.hh |
| 138 | 138 | ||
| 139 | libexec_PROGRAMS = nix-setuid-helper | ||
| 140 | nix_setuid_helper_SOURCES = \ | ||
| 141 | nix/nix-setuid-helper/nix-setuid-helper.cc | ||
| 142 | |||
| 143 | nix_setuid_helper_CPPFLAGS = \ | ||
| 144 | $(libutil_a_CPPFLAGS) | ||
| 145 | |||
| 146 | nix_setuid_helper_LDADD = \ | ||
| 147 | libutil.a libformat.a | ||
| 148 | |||
| 139 | noinst_HEADERS = \ | 149 | noinst_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 @@ | |||
| 27 | if [ -x "@abs_top_builddir@/guix-daemon" ] | 27 | if [ -x "@abs_top_builddir@/guix-daemon" ] |
| 28 | then | 28 | then |
| 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" |
