summaryrefslogtreecommitdiff
path: root/nix
AgeCommit message (Expand)Author
2018-01-07daemon: Make libbz2 an optional dependency....* 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. Ludovic Courtès
2018-01-07daemon: Add gzip log compression....* 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. Ludovic Courtès
2017-12-31list-runtime-root: Fix off-by-one in 'strip-drop' call....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. Ludovic Courtès
2017-11-26list-runtime-roots: Ignore ESRCH while reading from /proc....Fixes <https://bugs.gnu.org/29368>. Reported by Martin Castillo <castilma@uni-bremen.de>. * nix/scripts/list-runtime-roots.in (referenced-files): Ignore ESRCH. Ludovic Courtès
2017-11-12list-runtime-roots: Ignore PIDs we cannot access....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. Ludovic Courtès
2017-11-12list-runtime-roots: Canonicalize store items....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. Ludovic Courtès
2017-11-12list-runtime-roots: Do not use 'lsof'....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. Ludovic Courtès
2017-08-18nix: Remove unused function....* nix/libutil/util.hh: * nix/libutil/util.cc (decodeOctalEscaped): Remove unused and buggy function. Andy Wingo
2017-08-18Simplify remouting with MS_PRIVATE in sandbox build...also fix race condition if mounts are added after mountinfo is read. Jörg Thalheim
2017-08-07daemon: Ensure the child stack is aligned on a 16-byte boundary....* nix/libstore/build.cc (DerivationGoal::startBuilder): When calling 'clone', ensure that the stack is aligned on a 16-byte boundary. Mark H Weaver
2017-08-05daemon: On aarch64, use increments of 16 on the stack....* nix/libstore/build.cc (DerivationGoal::startBuilder): When on aarch64, when calling clone(), increment the stack by 16. Efraim Flashner
2017-08-05Revert "daemon: Ensure proper alignment on the stack."...This reverts commit ab4ccc8fcfaf2215d4b33b1376147e4c2c70426a. Mark H Weaver
2017-07-17daemon: Flush the sink upon 'exportPath' errors....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> Jan Nieuwenhuizen
2017-07-10daemon: Allow compilation with GCC 4.9....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. Ludovic Courtès
2017-06-22daemon: Set TCP_NODELAY and TCP_QUICKACK on remote sockets....* nix/nix-daemon/nix-daemon.cc (acceptConnection): Set TCP_NODELAY and TCP_QUICKACK on REMOTE. Ludovic Courtès
2017-06-22daemon: '--listen' can be passed several times, can specify TCP endpoints....* 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. Ludovic Courtès
2017-06-04daemon: Add '--timeout' and '--max-silent-time'....* 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". Ludovic Courtès
2017-05-30daemon: Report hash mismatches in a cleaner way....Suggested by Hartmut Goebel. * nix/libstore/build.cc (DerivationGoal::registerOutputs): Report hash mismatches on 3 lines for clarity. (SubstitutionGoal::finished): Likewise. Ludovic Courtès
2017-03-08list-runtime-roots: Bufferize the lsof pipe....* nix/scripts/list-runtime-roots.in (lsof-roots): Add 'setvbuf' call for PIPE. Ludovic Courtès
2017-03-06build: Don't embed absolute paths in .service and .conf service files....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@. Leo Famulari
2017-02-20daemon: Ensure proper alignment on the stack....* nix/libstore/build.cc (startBuilder): When calling 'clone', increase the step to 16 and ensure it aligns properly on the stack. Efraim Flashner
2017-02-07daemon: Define 'NIX_STORE' before invoking 'guix perform-download'....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'. Ludovic Courtès
2017-01-15daemon: Client settings no longer override daemon settings....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. Ludovic Courtès
2017-01-11daemon: Allow check builds of 'builtin:download' derivations....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. Ludovic Courtès
2016-12-29daemon: Allow fixed-output derivation builds with TMPDIR set....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)'. Ludovic Courtès
2016-12-20build: Delete all the .service and .conf files upon 'make clean'....* nix/local.mk (CLEANFILES): Define to add $(nodist_systemdservice_DATA) and $(nodist_upstartjob_DATA). Ludovic Courtès
2016-12-18build: Fix .service and .conf targets for VPATH builds....* nix/local.mk (etc/guix-%.service, etc/guix-%.conf): Use "$<", not "$(srcdir)/$<". Ludovic Courtès
2016-12-18build: Add 'guix-publish.*.in' to the distribution....This is a followup to 332d7903f52c2bf3741b04ac2d01cd9018b70800. * nix/local.mk (EXTRA_DIST): Add 'guix-service.publish.in' and 'guix-publish.conf.in'. Ludovic Courtès
2016-12-09daemon: Set ownership of kept build directories to the calling user....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. Hartmut Goebel
2016-12-05daemon: Fix invalid Boost format string....* nix/libstore/optimise-store.cc (LocalStore::optimisePath_): Use %3% instead of %m, the latter being an invalid Boost format specifier. Ludovic Courtès
2016-12-01daemon: Buffer data sent to clients by the 'export-path' RPC....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. Ludovic Courtès
2016-11-24Add system start-up files for "guix publish"....* .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. Hartmut Goebel
2016-11-16daemon: Add 'built-in-builders' RPC....* 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. Ludovic Courtès
2016-11-16daemon: Add "builtin:download" derivation builder....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> Ludovic Courtès
2016-10-28daemon: Do not error out when deduplication fails due to ENOSPC....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'. Ludovic Courtès
2016-10-28daemon: Improve the SQLite wrapper API....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> Eelco Dolstra
2016-10-28daemon: Factor out SQLite handling....* 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> Eelco Dolstra
2016-10-28daemon: Turn retrying SQLite transactions into a higher-order function....* 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> Eelco Dolstra
2016-06-26daemon: Rename 'NIX_CONF_DIR' to 'GUIX_CONFIGURATION_DIRECTORY'....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> David Craven
2016-05-31daemon: Substitute queries return immediately when substitutes are disabled....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. Ludovic Courtès
2016-05-31daemon: Fix typo....Fixes a regression/typo introduced in e08380fb6cefd3fd67c3c220a3ddaf385e6413cf. * nix/libstore/build.cc (DerivationGoal::startBuilder): Canonicalize "/tmp", not "/tmp/guix-build". Ludovic Courtès
2016-05-31daemon: Remove unused XML output code....* 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. Ludovic Courtès
2016-05-31daemon: rounds: Keep the differing output if -K is given....Regardless of -K, we now also print which output differs. Eelco Dolstra
2016-05-31daemon: Canonicalize gids to 0....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. Eelco Dolstra
2016-05-31daemon: check: Keep the differing output if -K is given....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> Eelco Dolstra
2016-05-31daemon: check: Fix "failed to produce output path"....This occured when sandbox building is disabled, at least one output exists, and at least one other output does not. Eelco Dolstra
2016-05-31daemon: check: Fix assertion failure when some outputs are missing....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. Eelco Dolstra
2016-05-31daemon: When repairing, rebuild if there is no substituter.Eelco Dolstra
2016-05-31daemon: Fix --repair failure on multiple-output derivations....If repair found a corrupted/missing path that depended on a multiple-output derivation, and some of the outputs of the latter were not present, it failed with a message like error: path ‘/nix/store/cnfn9d5fjys1y93cz9shld2xwaibd7nn-bash-4.3-p42-doc’ is not valid Co-authored-by: Ludovic Courtès <ludo@gnu.org> Eelco Dolstra
2016-05-31daemon: ~PathLocks(): Handle exceptions....Otherwise, since the call to write a "d" character to the lock file can fail with ENOSPC, we can get an unhandled exception resulting in a call to terminate(). Eelco Dolstra