aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-07-03nix-daemon: Respect --storeEelco Dolstra
For example, this allows you to do run nix-daemon as a non-privileged user: eelco$ NIX_STATE_DIR=~/my-nix/nix/var nix-daemon --store ~/my-nix/ The NIX_STATE_DIR is still needed because settings.nixDaemonSocketFile is not derived from settings.storeUri (and we can't derive it from the store's state directory because we don't want to open the store in the parent process).
2018-07-03Include cpptoml for build simplicityEelco Dolstra
2018-07-03Add a fromTOML primopEelco Dolstra
This is primarily useful for processing Cargo.lock files.
2018-07-03Store floating point numbers in double precisionEelco Dolstra
Even on 32-bit systems, Value has enough space to hold a double.
2018-07-03nix why-depends: render output into $PAGERMaximilian Bosch
2018-07-02Merge pull request #2158 from Ma27/improve-search-uxEelco Dolstra
search.cc: improve UX for `nix search`
2018-07-02search.cc: improve UX for `nix search`Maximilian Bosch
As proposed in #1634 the `nix search` command could use some improvements. Initially 0413aeb35d6ee869a98b6565781c1cf47dc80080 added some basic sorting behavior using `std::map`, a next step would be an improvement of the output. This patch includes the following changes: * Use `$PAGER` for outputs with `RunPager` from `shared.hh`: The same behavior is defined for `nix-env --query`, furthermore it makes searching huge results way easier. * Simplified result blocks: The new output is heavily inspired by the output from `nox`, the first line shows the attribute path and the derivaiton name (`attribute path (derivation name)`) and the description in the second line.
2018-06-18progress-bar: re-draw last update if nothing new for 1sec.Will Dietz
Slightly nicer behavior when updates are somewhat far apart (during a long linking step, perhaps) ensuring things don't appear unresponsive. If we wait the maximum amount for the update, don't bother waiting another 50ms (for rate-limiting purposes) and just check if we should quit. This also ensures we'll notice the request to quit within 1s if quit is signalled but there is not an udpate. (I'm not sure if this happens or not)
2018-06-18sync.hh: return cv_status instead of dropping it, in case useful.Will Dietz
2018-06-18Detect redirect loopsEelco Dolstra
Fixes #2225.
2018-06-18Merge pull request #2234 from symphorien/esrch2Eelco Dolstra
libstore/gc.cc: ignore ESRCH when reading symlinks in /proc
2018-06-16libstore/gc.cc: ignore ESRCH when reading symlinks in /procSymphorien Gibol
readlink is also affected by the problem fixed for regular files in c567afe355df
2018-06-14Fix optimise-store.cc to skip more paths on macOSMatthew Justin Bauer
I hate to make this such a large check but the lack of documentation means we really have no idea what's allowed. All of them reported so far have been within ".app/Contents" directories. That appears to be a safe starting point. However, I would not be surprised to also find more paths that are disallowed for instance in .framework or .bundle directories. Fixes #2031 Fixes #2229
2018-06-13nix: Remove special handling of .drv filesEelco Dolstra
This makes 'nix copy' and 'nix path-info' work on .drv store paths. Removing special treatment of .drv files seems the most future-proof approach given the possible removal of .drv files in the future. Note that 'nix build' will still build (rather than substitute) .drv paths due to the unfortunate overloading in Store::buildPaths().
2018-06-13hashDerivationModulo(): Handle chroot storesEelco Dolstra
This makes 'nix copy --to /mnt /nix/store/bla.drv' work.
2018-06-13std::random_shuffle -> std::shuffleEelco Dolstra
The former is removed in C++17.
2018-06-12Move EvalState from the stack to the heapEelco Dolstra
EvalState contains a few counters (e.g. nrValues) that increase quickly enough that they end up being interpreted as pointers by the garbage collector. Moving it to the heap makes them invisible to the garbage collector. This reduces the max RSS doing 100 evaluations of nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB. Note: ideally, allocations would be much further up in the 64-bit address space to reduce the odds of an integer being misinterpreted as a pointer. Maybe we can use some linker magic to move the .bss segment to a higher address.
2018-06-12GC_malloc -> GC_MALLOCEelco Dolstra
This makes it possible to build with -DGC_DEBUG.
2018-06-12Don't scan for roots in dynamic librariesEelco Dolstra
This reduces the risk of object liveness misdetection. For example, Glibc has an internal variable "mp_" that often points to a Boehm object, keeping it alive unnecessarily. Since we don't store any actual roots in global variables, we can just disable data segment scanning. With this, the max RSS doing 100 evaluations of nixos.tests.firefox.x86_64-linux.drvPath went from 718 MiB to 455 MiB.
2018-06-12Add temporary statsEelco Dolstra
2018-06-12Cache parse treesEelco Dolstra
This prevents EvalState::resetFileCache() from parsing everything all over again.
2018-06-12Remove duplicate definition of allocBytes()Eelco Dolstra
2018-06-12Fix #2162: use getaddrinfo instead of curl to preload NSSYorick van Pelt
2018-06-11libstore/gc.cc: ignore ESRCH when reading /procSymphorien Gibol
If a process disappears between the time /proc/[pid]/maps is opened and the time it is read, the read() syscall will return ESRCH. This should be ignored.
2018-06-08use debug instead of printTalkative to avoid spamming hydra queueAmineChikhaoui
runner logs.
2018-06-05Don't require --fallback to recover from disappeared binary cache NARsEelco Dolstra
2018-06-05Handle HTTP 410 Gone errorsEelco Dolstra
2018-06-05Improve binary cache fallback testEelco Dolstra
2018-06-05Further improve upload messagesEelco Dolstra
2018-06-01download.cc: fix readCallback return type (int -> size_t)Will Dietz
I'm not sure if curl ever asks for enough data at once for truncation to occur but better safe than sorry.
2018-06-01Improve binary cache upload messagesEelco Dolstra
Don't say "download" when we mean "upload".
2018-05-31Merge pull request #767 from mogorman/garbage_collect_keep_last_fewPeter Simons
Implement --delete-generations + flag for keeping last N number of gens
2018-05-30Fix static assertion failure on 32-bit systemsEelco Dolstra
2018-05-30RemoteStore::addToStore(): Ensure capacity is decreased on exceptionsEelco Dolstra
2018-05-30Fix deadlock in RemoteStore::queryPathInfoUncached()Eelco Dolstra
2018-05-30Make <nix/fetchurl.nix> run in constant memoryEelco Dolstra
E.g. nix-build --store ~/my-nix/ -E 'import <nix/fetchurl.nix> { url = https://cache.nixos.org/nar/0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv.nar.xz; sha256 = "0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv"; }' now runs in 17 MiB (was 70 MiB), while nix-build --store ~/my-nix/ -E 'import <nix/fetchurl.nix> { url = https://cache.nixos.org/nar/0nwi996rgq4b914qyx0mv2wq4k80hjac7xilikavagw7kxmn2iiv.nar.xz; sha256 = "0d2fxljdih3nc5dqx41hjzic3141ajil94m8kdbpryq569dpsbvb"; unpack = true; }' runs in 17 MiB (was 346 MiB).
2018-05-30getDownloader(): SimplifyEelco Dolstra
2018-05-30Make HttpBinaryCacheStore::narFromPath() run in constant memoryEelco Dolstra
This reduces memory consumption of nix copy --from https://cache.nixos.org --to ~/my-nix /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 176 MiB to 82 MiB. (The remaining memory is probably due to xz decompression overhead.) Issue https://github.com/NixOS/nix/issues/1681. Issue https://github.com/NixOS/nix/issues/1969.
2018-05-30Make LocalBinaryCacheStore::narFromPath() run in constant memoryEelco Dolstra
This reduces memory consumption of nix copy --from file://... --to ~/my-nix /nix/store/95cwv4q54dc6giaqv6q6p4r02ia2km35-blender-2.79 from 514 MiB to 18 MiB for an uncompressed binary cache, and from 192 MiB to 53 MiB for a bzipped binary cache. It may also be faster because fetching can happen concurrently with decompression/writing. Continuation of 48662d151bdf4a38670897beacea9d1bd750376a. Issue https://github.com/NixOS/nix/issues/1681.
2018-05-30Simplify the callback mechanismEelco Dolstra
2018-05-30Move evaluator-specific settings out of libstoreEelco Dolstra
2018-05-30Move some Download-specific settings to download.ccEelco Dolstra
2018-05-30Modularize config settingsEelco Dolstra
Allow global config settings to be defined in multiple Config classes. For example, this means that libutil can have settings and evaluator settings can be moved out of libstore. The Config classes are registered in a new GlobalConfig class to which config files etc. are applied. Relevant to https://github.com/NixOS/nix/issues/2009 in that it removes the need for ad hoc handling of useCaseHack, which was the underlying cause of that issue.
2018-05-30Fix assertion failure in storePathToHash()Eelco Dolstra
Fixes https://github.com/NixOS/nix/issues/2015.
2018-05-30Make 'nix copy --to daemon' run in constant memory (daemon side)Eelco Dolstra
Continuation of 97002b684c902dadcd351a67208f9c2a88ff8f8f. This makes the daemon use constant memory. For example, it reduces the daemon's maximum RSS on $ nix copy --from ~/my-nix --to daemon /nix/store/1n7x0yv8vq6zi90hfmian84vdhd04bgp-blender-2.79a from 264 MiB to 7 MiB. We now use a TunnelSource to prevent the connection from ending up in an undefined state if an exception is thrown while the NAR is being sent. Issue https://github.com/NixOS/nix/issues/1681.
2018-05-30LocalStore::addToStore: Throw an exception if no hash is givenEelco Dolstra
2018-05-30Use extended SQLite error codesEelco Dolstra
2018-05-28Merge pull request #2187 from bgamari/stoi-exceptionsEelco Dolstra
json-to-value: Use strtol instead of strtoi
2018-05-26json-to-value: Use strtol instead of strtoiBen Gamari
NixInt is long, so strtoi is too restrictive.
2018-05-26eval.cc: add message to static_assert, message can be omitted w/c++17Will Dietz