summaryrefslogtreecommitdiff
path: root/nix
Commit message (Collapse)AuthorAge
...
* daemon: Remove dead code.Ludovic Courtès2018-03-30
| | | | | | | | | | | * nix/libstore/globals.cc (Settings::loadConfFile, Settings::unpack): Remove. * nix/libstore/globals.hh: Adjust accordingly. * nix/libstore/misc.cc (queryMissing): Remove. * nix/libstore/misc.hh: Adjust accordingly. * nix/libstore/store-api.cc (followLinksToStore) (followLinksToStorePath, computeStorePathForHash): Remove. * nix/libstore/store-api.hh: Adjust accordingly.
* daemon: Always try to execute the builder regardless of the platform.Ludovic Courtès2018-01-11
| | | | | * nix/libstore/build.cc (runChild): Move platform check after 'execve' call. Check specifically for ENOEXEC.
* daemon: Make libbz2 an optional dependency.Ludovic Courtès2018-01-07
| | | | | | | | | | | | | | * config-daemon.ac: Don't bail out when libbz2 is missing. Define 'HAVE_LIBBZ2' Automake conditional. * nix/libstore/build.cc: Wrap relevant bits in '#if HAVE_BZLIB_H'. * nix/libstore/globals.cc (Settings::Settings): 'logCompression' defaults to COMPRESSION_GZIP when HAVE_BZLIB_H is false. * nix/libstore/globals.hh (CompressionType): Make 'COMPRESSION_BZIP2' conditional on HAVE_BZLIB_H. * nix/local.mk (guix_register_LDADD, guix_daemon_LDADD): Add -lbz2 only when HAVE_LIBBZ2. * nix/nix-daemon/guix-daemon.cc (parse_opt): Ignore "bzip2" when not HAVE_BZLIB_H.
* daemon: Add gzip log compression.Ludovic Courtès2018-01-07
| | | | | | | | | | | | | | | | | | | | * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_LOG_COMPRESSION): New macro. (options): Mark "disable-log-compression" as hidden and add "log-compression". (parse_opt): Handle GUIX_OPT_LOG_COMPRESSION. * nix/libstore/build.cc (DerivationGoal): Add 'gzLogFile'. (openLogFile): Initialize it when 'logCompression' is COMPRESSION_GZIP. (closeLogFile, handleChildOutput): Honor 'gzLogFile'. * nix/libstore/globals.hh (Settings)[compressLog]: Remove. [logCompression]: New field. (CompressionType): New enum. * nix/libstore/globals.cc (Settings::Settings): Initialize it. (update): Remove '_get' call for 'compressLog'. * nix/local.mk (guix_daemon_LDADD, guix_register_LDADD): Add -lz. * guix/store.scm (log-file): Handle '.gz' log files. * tests/guix-daemon.sh: Add test with '--log-compression=gzip'. * doc/guix.texi (Invoking guix-daemon): Adjust accordingly. * config-daemon.ac: Check for libz and zlib.h.
* list-runtime-root: Fix off-by-one in 'strip-drop' call.Ludovic Courtès2017-12-31
| | | | | | | | | Fixes <https://bugs.gnu.org/29862>. Reported by Danny Milosavljevic <dannym@scratchpost.org>. * nix/scripts/list-runtime-roots.in (canonicalize-store-item): Define 'store' with a trailing "/". Have the 'string-prefix?' call match the 'string-drop' call.
* list-runtime-roots: Ignore ESRCH while reading from /proc.Ludovic Courtès2017-11-26
| | | | | | | Fixes <https://bugs.gnu.org/29368>. Reported by Martin Castillo <castilma@uni-bremen.de>. * nix/scripts/list-runtime-roots.in (referenced-files): Ignore ESRCH.
* list-runtime-roots: Ignore PIDs we cannot access.Ludovic Courtès2017-11-12
| | | | | | | | This allows running as non-root. Fixes a regression introduced in b8f59cdc20e9d83ce63523ef917e95fcee07f134. * nix/scripts/list-runtime-roots.in (referenced-files): Handle EACCES in addition to ENOENT.
* list-runtime-roots: Canonicalize store items.Ludovic Courtès2017-11-12
| | | | | | | | | | Looking at 'addAdditionalRoots' in libstore/gc.cc, it looks like it should always have been this way. In practice it probably doesn't make much of a difference. * nix/scripts/list-runtime-roots.in (canonicalize-store-item): New procedure. <top level>: Use it.
* list-runtime-roots: Do not use 'lsof'.Ludovic Courtès2017-11-12
| | | | | | | | | This makes things a bit faster (0.8s instead of 1.4s on my laptop). * nix/scripts/list-runtime-roots.in (lsof-roots): Remove. (proc-fd-roots): Return the empty list when 'scandir' returns #f. (referenced-files): New procedure. Use it at the top level.
* nix: Remove unused function.Andy Wingo2017-08-18
| | | | | * nix/libutil/util.hh: * nix/libutil/util.cc (decodeOctalEscaped): Remove unused and buggy function.
* Simplify remouting with MS_PRIVATE in sandbox buildJörg Thalheim2017-08-18
| | | | also fix race condition if mounts are added after mountinfo is read.
* daemon: Ensure the child stack is aligned on a 16-byte boundary.Mark H Weaver2017-08-07
| | | | | * nix/libstore/build.cc (DerivationGoal::startBuilder): When calling 'clone', ensure that the stack is aligned on a 16-byte boundary.
* daemon: On aarch64, use increments of 16 on the stack.Efraim Flashner2017-08-05
| | | | | * nix/libstore/build.cc (DerivationGoal::startBuilder): When on aarch64, when calling clone(), increment the stack by 16.
* Revert "daemon: Ensure proper alignment on the stack."Mark H Weaver2017-08-05
| | | | This reverts commit ab4ccc8fcfaf2215d4b33b1376147e4c2c70426a.
* daemon: Flush the sink upon 'exportPath' errors.Jan Nieuwenhuizen2017-07-17
| | | | | | | | | | | | | | | | | Prior to this change, errors such as wrong permissions on /etc/guix/signing-key.sec would give: guix-daemon: nix/libutil/serialise.cc:15: virtual nix::BufferedSink::~BufferedSink(): Assertion `!bufPos' failed. This patch correctly propagates the error to the client and thus changes that to: error: build failed: file `/etc/guix/signing-key.sec' should be secret (inaccessible to everybody else)! * nix/nix-daemon/nix-daemon.cc (performOp): Wrap 'exportPath' call in 'try' block. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Allow compilation with GCC 4.9.Ludovic Courtès2017-07-10
| | | | | | | | Reported by Ricardo Wurmus. * nix/nix-daemon/nix-daemon.cc (acceptConnection): Remove intermediate 'inaddr' variables that relied on implicit casts. This fixes compilation with GCC 4.9.
* daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets.Ludovic Courtès2017-06-22
| | | | | * nix/nix-daemon/nix-daemon.cc (acceptConnection): Set TCP_NODELAY and TCP_QUICKACK on REMOTE.
* daemon: '--listen' can be passed several times, can specify TCP endpoints.Ludovic Courtès2017-06-22
| | | | | | | | | | | | | | | | * nix/nix-daemon/guix-daemon.cc (DEFAULT_GUIX_PORT): New macro. (listen_options): New variable. (parse_opt): Push back '--listen' options to LISTEN_OPTIONS. (open_unix_domain_socket, open_inet_socket) (listening_sockets): New functions. (main): Use it. Pass SOCKETS to 'run'. * nix/nix-daemon/nix-daemon.cc (matchUser): Remove. (SD_LISTEN_FDS_START): Remove. (acceptConnection): New function. (daemonLoop): Rewrite to take a vector of file descriptors, to select(2) on them, and to call 'acceptConnection'. (run): Change to take a vector of file descriptors. * tests/guix-daemon.sh: Add test.
* daemon: Add '--timeout' and '--max-silent-time'.Ludovic Courtès2017-06-04
| | | | | | | | | | | | | * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_TIMEOUT) (GUIX_OPT_MAX_SILENT_TIME): New macros. * nix/nix-daemon/guix-daemon.cc (options): Add '--timeout' and '--max-silent-time'. (parse_opt): Honor them. * tests/guix-daemon.sh: Add test. * doc/guix.texi (Invoking guix-daemon): Document the options. (Common Build Options): Properly describe default timeout/max-silent-time value. Add cross-ref to "Invoking guix-daemon".
* daemon: Report hash mismatches in a cleaner way.Ludovic Courtès2017-05-30
| | | | | | | | Suggested by Hartmut Goebel. * nix/libstore/build.cc (DerivationGoal::registerOutputs): Report hash mismatches on 3 lines for clarity. (SubstitutionGoal::finished): Likewise.
* list-runtime-roots: Bufferize the lsof pipe.Ludovic Courtès2017-03-08
| | | | | * nix/scripts/list-runtime-roots.in (lsof-roots): Add 'setvbuf' call for PIPE.
* build: Don't embed absolute paths in .service and .conf service files.Leo Famulari2017-03-06
| | | | | | | | | | Otherwise, users will be stuck running an old copy of guix and the guix-daemon if they copy the service files instead of symlinking them. * etc/guix-daemon.conf.in, etc/guix-daemon.service.in, etc/guix-publish.conf.in, etc/guix-publish.service.in: Expand @localstatedir@ instead of @bindir@. * nix/local.mk (etc/guix-%.service, etc/guix-%.conf): Use @localstatedir@ instead of @bindir@.
* daemon: Ensure proper alignment on the stack.Efraim Flashner2017-02-20
| | | | | * nix/libstore/build.cc (startBuilder): When calling 'clone', increase the step to 16 and ensure it aligns properly on the stack.
* daemon: Define 'NIX_STORE' before invoking 'guix perform-download'.Ludovic Courtès2017-02-07
| | | | | | | | | | | | | Reported by rohit yadav <rohityadav@utexas.edu> at <https://lists.gnu.org/archive/html/guix-devel/2017-02/msg00191.html>. This fixes a regression whereby 'guix perform-download' would always see NIX_STORE as unset and thus use "/gnu/store", leading it to miscompute the hydra.gnu.org content-addressed URLs when the store file name is not "/gnu/store". * nix/libstore/builtins.cc (builtinDownload): Add 'setenv' call for 'NIX_STORE'.
* daemon: Client settings no longer override daemon settings.Ludovic Courtès2017-01-15
| | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/20217>. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x161. * nix/nix-daemon/nix-daemon.cc (performOp): "build-max-jobs", "build-max-silent-time", and "build-cores" are no longer read upfront; instead, read them from the key/value list at the end. * nix/nix-daemon/guix-daemon.cc (main): Explicitly set 'settings.maxBuildJobs'. * guix/store.scm (%protocol-version): Bump to #x161. (set-build-options): #:max-build-jobs, #:max-silent-time, and #:build-cores now default to #f. Adjust handshake to new protocol. * tests/store.scm ("build-cores"): New test. * tests/guix-daemon.sh: Add test for default "build-cores" value.
* daemon: Allow check builds of 'builtin:download' derivations.Ludovic Courtès2017-01-11
| | | | | | | | | | | | | | | | | | Fixes <http://bugs.gnu.org/25089>. Reported by Leo Famulari <leo@famulari.name>. * nix/libstore/build.cc (DerivationGoal::runChild): In the 'isBuiltin' case, check whether DRV's output is in 'redirectedOutputs', and pass an 'output' argument to the built-in builder. (DerivationGoal::addHashRewrite): Add 'printMsg' call. * nix/libstore/builtins.hh (derivationBuilder): Add 'output' parameter. * nix/libstore/builtins.cc (builtinDownload): Likewise. Add OUTPUT to ARGV. * guix/scripts/perform-download.scm (perform-download): Add 'output' parameter. (guix-perform-download): Adjust 'match' clauses accordingly. * tests/derivations.scm ("'download' built-in builder, check mode"): New test.
* daemon: Allow fixed-output derivation builds with TMPDIR set.Ludovic Courtès2016-12-29
| | | | | | | | | | | Fixes <http://bugs.gnu.org/25242>. Reported by Leo Famulari <leo@famulari.name>. The regression was introduced in 94d92c7796a3dd50c27d532315f7d497ac99f08e. * nix/libstore/build.cc (DerivationGoal::startBuilder): Set 'useChroot' as a function 'of isBuiltin(drv)'. (DerivationGoal::runChild): Use 'useChroot' instead of 'useChroot && !isBuiltin(drv)'.
* build: Delete all the .service and .conf files upon 'make clean'.Ludovic Courtès2016-12-20
| | | | | * nix/local.mk (CLEANFILES): Define to add $(nodist_systemdservice_DATA) and $(nodist_upstartjob_DATA).
* build: Fix .service and .conf targets for VPATH builds.Ludovic Courtès2016-12-18
| | | | | * nix/local.mk (etc/guix-%.service, etc/guix-%.conf): Use "$<", not "$(srcdir)/$<".
* build: Add 'guix-publish.*.in' to the distribution.Ludovic Courtès2016-12-18
| | | | | | | This is a followup to 332d7903f52c2bf3741b04ac2d01cd9018b70800. * nix/local.mk (EXTRA_DIST): Add 'guix-service.publish.in' and 'guix-publish.conf.in'.
* daemon: Set ownership of kept build directories to the calling user.Hartmut Goebel2016-12-09
| | | | | | | | | | | Fixes <http://bugs.gnu.org/15890>. * nix/libstore/globals.hh (Settings) Add clientUid and clientGid. * nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the caller in settings. * nix/libstore/build.cc (_chown): New function. (DerivationGoal::deleteTmpDir): Use it, change ownership of build directory if it is kept and the new owner is not root.
* daemon: Fix invalid Boost format string.Ludovic Courtès2016-12-05
| | | | | * nix/libstore/optimise-store.cc (LocalStore::optimisePath_): Use %3% instead of %m, the latter being an invalid Boost format specifier.
* daemon: Buffer data sent to clients by the 'export-path' RPC.Ludovic Courtès2016-12-01
| | | | | | | | | | | | | | | | Before that we'd have STDERR_WRITE round trips for very small amounts of data, ranging from a few bytes for the metadata of nars to the size of one file being exported. With this change, something like: guix archive --export /gnu/store/5rrsbaghh5ix1vjcicsl60gsxilhjnf2-coreutils-8.25 | dd of=/dev/null reports a throughput of 35 MB/s instead of 25 MB/s before. * nix/nix-daemon/nix-daemon.cc (TunnelSink): Inherit from 'BufferedSink' rather than 'Sink'. Rename 'operator ()' to 'write'. (performOp) <wopExportPath>: Add 'sink.flush' call.
* Add system start-up files for "guix publish".Hartmut Goebel2016-11-24
| | | | | | | | | | | | | * .gitignore: add etc/guix-publish.conf and /etc/guix-publish.service. * etc/guix-publish.conf.in: New file. * etc/guix-publish.service.in: New file. * nix/local.mk (etc/guix-%.service, etc/guix-%.conf): Generalized former build-rules for by using patterns. (nodist_systemdservice_DATA): Add etc/guix-publish.service, update comment. (nodist_upstartjob_DATA): Add etc/guix-publish.conf, update comment. * doc/guix.texi (Invoking guix publish): Add description for enabling "guix publish" on host distros using the new files.
* daemon: Add 'built-in-builders' RPC.Ludovic Courtès2016-11-16
| | | | | | | | | | | | * nix/libstore/builtins.cc (builtinBuilderNames): New function. * nix/libstore/builtins.hh (builtinBuilderNames): New declaration. * nix/libstore/worker-protocol.hh (PROTOCOL_VERSION): Bump to 0x160. (WorkerOp)[wopBuiltinBuilders]: New value. * nix/nix-daemon/nix-daemon.cc (performOp): Handle it. * guix/store.scm (operation-id)[built-in-builders]: New value. * guix/store.scm (read-arg): Add 'string-list'. (built-in-builders): New procedure. * tests/derivations.scm ("built-in-builders"): New test.
* daemon: Add "builtin:download" derivation builder.Ludovic Courtès2016-11-16
| | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that 1) the derivation doesn't change when Guix changes; 2) the derivation closure doesn't contain Guix and its dependencies; 3) we don't have to rely on ugly chroot hacks. Adapted from Nix commit 0a2bee307b20411f5b0dda0c662b1f9bb9e0e131. * nix/libstore/build.cc (DerivationGoal::runChild): Add special case for 'isBuiltin(drv)'. Disable chroot when 'isBuiltin(drv)'. * nix/libstore/builtins.cc, nix/libstore/builtins.hh, nix/scripts/download.in, guix/scripts/perform-download.scm: New files. * guix/ui.scm (show-guix-help)[internal?]: Add 'perform-download'. * nix/local.mk (libstore_a_SOURCES): Add builtins.cc. (libstore_headers): Add builtins.hh. (nodist_pkglibexec_SCRIPTS): Add 'scripts/download'. * config-daemon.ac: Emit 'scripts/download'. * Makefile.am (MODULES): Add 'guix/scripts/perform-download.scm'. * tests/derivations.scm ("unknown built-in builder") ("'download' built-in builder") ("'download' built-in builder, invalid hash") ("'download' built-in builder, not found") ("'download' built-in builder, not fixed-output"): New tests. Co-authored-by: Eelco Dolstra <eelco.dolstra@logicblox.com>
* daemon: Do not error out when deduplication fails due to ENOSPC.Ludovic Courtès2016-10-28
| | | | | | | | | | This solves a problem whereby if /gnu/store/.links had enough entries, ext4's directory index would be full, leading to link(2) returning ENOSPC. * nix/libstore/optimise-store.cc (LocalStore::optimisePath_): Upon ENOSPC from link(2), print a message and return instead of throwing a 'SysError'.
* daemon: Improve the SQLite wrapper API.Eelco Dolstra2016-10-28
| | | | | | | | | | | In particular, this eliminates a bunch of boilerplate code. Also integrates these Nix commits: 80da7a6 Probably fix SQLITE_BUSY errors 37a337b throwSQLiteError(): Check for SIGINT so we don't loop forever Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Factor out SQLite handling.Eelco Dolstra2016-10-28
| | | | | | | | | * nix/libstore/local-store.cc: Move SQLite code to... * nix/libstore/sqlite.cc, nix/libstore/sqlite.hh: ... here. New files. * nix/local.mk (libstore_a_SOURCES): Add sqlite.cc. (libstore_headers): Add sqlite.hh. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Turn retrying SQLite transactions into a higher-order function.Eelco Dolstra2016-10-28
| | | | | | | | | | | | | | | | * nix/libstore/local-store.cc (retry_sqlite, end_retry_sqlite): Remove. (retrySQLite): New template. (LocalStore::registerFailedPath, LocalStore::hasPathFailed) (LocalStore::queryFailedPaths, LocalStore::clearFailedPaths) (LocalStore::queryPathInfo, LocalStore::isValidPath_) (LocalStore::queryValidPaths, LocalStore::queryAllValidPaths) (LocalStore::queryReferrers, LocalStore::queryValidDerivers) (LocalStore::queryDerivationOutputs) (LocalStore::queryDerivationOutputNames) (LocalStore::queryPathFromHashPart, LocalStore::registerValidPaths) (LocalStore::invalidatePathChecked): Use it. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Rename 'NIX_CONF_DIR' to 'GUIX_CONFIGURATION_DIRECTORY'.David Craven2016-06-26
| | | | | | | | | | | | | | Partly fixes <http://bugs.gnu.org/22459>. Reported by Jeff Mickey <j@codemac.net> and David Craven <david@craven.ch>. * nix/libstore/globals.cc (Settings::processEnvironment()): Change 'NIX_CONF_DIR' to 'GUIX_CONFIGURATION_DIRECTORY'. * nix/local.mk (libstore_a_CPPFLAGS): Likewise. * guix/config.scm.in (%config-directory): Likewise. * build-aux/test-env.in: Likewise. * gnu/packages/patches/hydra-automake-1.15.patch: Likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* daemon: Substitute queries return immediately when substitutes are disabled.Ludovic Courtès2016-05-31
| | | | | | | | | | | | | Reported by Federico Beffa <beffa@ieee.org> at <https://lists.gnu.org/archive/html/guix-devel/2016-05/msg00928.html>. * nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths) (LocalStore::querySubstitutablePathInfos): Return when 'settings.useSubstitutes' is false. * tests/store.scm ("references/substitutes missing reference info"): Make sure to return #f on failure. * tests/store.scm ("substitutable-path-info when substitutes are turned off"): ("substitutable-paths when substitutes are turned off"): New tests.
* daemon: Fix typo.Ludovic Courtès2016-05-31
| | | | | | | | Fixes a regression/typo introduced in e08380fb6cefd3fd67c3c220a3ddaf385e6413cf. * nix/libstore/build.cc (DerivationGoal::startBuilder): Canonicalize "/tmp", not "/tmp/guix-build".
* daemon: Remove unused XML output code.Ludovic Courtès2016-05-31
| | | | | | * nix/local.mk (libutil_a_SOURCES): Remove libutil/xml-writer.cc. (libutil_headers): Remove libutil/xml-writer.hh. * nix/libutil/xml-writer.hh, nix/libutil/xml-writer.cc: Remove.
* daemon: rounds: Keep the differing output if -K is given.Eelco Dolstra2016-05-31
| | | | Regardless of -K, we now also print which output differs.
* daemon: Canonicalize gids to 0.Eelco Dolstra2016-05-31
| | | | | | | Previously files in the Nix store were owned by root or by nixbld, depending on whether they were created by a substituter or by a builder. This doesn't matter much, but causes spurious diffoscope differences. So use root everywhere.
* daemon: check: Keep the differing output if -K is given.Eelco Dolstra2016-05-31
| | | | | | | | | | | | | | | | | | | This makes it easier to investigate the non-determinism, e.g. $ nix-build pkgs/stdenv/linux -A stage1.pkgs.zlib --check -K error: derivation ‘/nix/store/l54i8wlw22656i4pk05c52ngv9rpl39q-zlib-1.2.8.drv’ may not be deterministic: output ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8’ differs from ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check’ $ diffoscope /nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8 /nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check ... ├── lib/libz.a │ ├── metadata │ │ @@ -1,15 +1,15 @@ │ │ -rw-r--r-- 30001/30000 3096 Jan 12 15:20 2016 adler32.o ... │ │ +rw-r--r-- 30001/30000 3096 Jan 12 15:28 2016 adler32.o ... Co-authored-by: Ludovic Courtès <ludo@gnu.org>
* daemon: check: Fix "failed to produce output path".Eelco Dolstra2016-05-31
| | | | | This occured when sandbox building is disabled, at least one output exists, and at least one other output does not.
* daemon: check: Fix assertion failure when some outputs are missing.Eelco Dolstra2016-05-31
| | | | | | | | | | | E.g. $ nix-build pkgs/stdenv/linux/ -A stage1.pkgs.perl --check nix-store: src/libstore/build.cc:1323: void nix::DerivationGoal::tryToBuild(): Assertion `buildMode != bmCheck || validPaths.size() == drv->outputs.size()' failed. when perl.out exists but perl.man doesn't. The fix is to only check the outputs that exist. Note that "nix-build -A stage1.pkgs.all --check" will still give a (proper) error in this case.
* daemon: When repairing, rebuild if there is no substituter.Eelco Dolstra2016-05-31
|