aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-12-13Initial gzip supportTom Bereknyei
Closes #3256
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2019-12-10EvalState::callFunction(): Make FunctionCallTrace use less stack spaceEelco Dolstra
The FunctionCallTrace object consumes a few hundred bytes of stack space, even when tracing is disabled. This was causing stack overflows: $ nix-instantiate '<nixpkgs> -A texlive.combined.scheme-full --dry-run error: stack overflow (possible infinite recursion) This is with the default stack size of 8 MiB. Putting the object on the heap reduces stack usage to < 5 MiB.
2019-12-09Remove UserLock self-lock checkEelco Dolstra
This is no longer needed since we're not using POSIX locks anymore.
2019-12-05Shut up clang warningEelco Dolstra
(cherry picked from commit 3392f1b77869269580b58e4931b7a79f44799ce0)
2019-12-05nix doctor: Fix typoEelco Dolstra
(cherry picked from commit 96c6b08ed7f99be84cb1816515a368392d19dbb5)
2019-12-05Show hash mismatch warnings in SRI formatEelco Dolstra
(cherry picked from commit 63c5c91cc053cbc1fcb8d3fe71c41142c9f51bfa)
2019-12-05Move #includeEelco Dolstra
(cherry picked from commit 8beedd44861d1fe7208609ee8d231ca1c02dedf6)
2019-12-05Bindings: Add convenience method for requiring an attributeEelco Dolstra
(cherry picked from commit fb692e5f7b34def8cf590298036ab63e40747062)
2019-12-05Bindings::get(): Add convenience methodEelco Dolstra
This allows writing attribute lookups as if (auto name = value.attrs->get(state.sName)) ... (cherry picked from commit f216c76c56cdffb5214d074a7d44812843dd174f)
2019-12-05Initialize Command::_nameEelco Dolstra
(cherry picked from commit d0a769cb061a13ad880c76e5ea69a76150439853)
2019-12-05Make subcommand construction in MultiCommand lazyEelco Dolstra
(cherry picked from commit a0de58f471c9087d8e6cc60a6078f9940a125b15)
2019-12-05Move Command and MultiCommand to libutilEelco Dolstra
(cherry picked from commit f70434b1fbbdb0e188718f0c55a8156a7aa08744)
2019-12-05MultiCommand: Simplify constructionEelco Dolstra
(cherry picked from commit 15a16e5c05d547ec07170df2392263e5e891447b)
2019-12-05Eliminate more pass-by-value in variadic callsEelco Dolstra
2019-12-05Revert "Make fmt() non-recursive"Eelco Dolstra
This reverts commit 2b761d5f50b7dc17dc55c31980c2253c37b3c920. Also *really* make fmt() take arguments by reference.
2019-12-05fmt(): Pass arguments by reference rather than by valueEelco Dolstra
2019-12-02Merge remote-tracking branch 'origin/recursive-nix'Eelco Dolstra
2019-11-30Fix typosBrian Wignall
2019-11-29Merge pull request #2748 from edolstra/rustEelco Dolstra
Make nix/unpack-channel.nix a builtin builder
2019-11-28Remove builtins.valueSizeEelco Dolstra
Fixes #3246.
2019-11-27Fix segfault on i686-linuxEelco Dolstra
https://hydra.nixos.org/build/107467517 Seems that on i686-linux, gcc and rustc disagree on how to return 1-word structs: gcc has the caller pass a pointer to the result, while rustc has the callee return the result in a register. Work around this by using a bare pointer.
2019-11-26Drop remaining uses of external "tar"Eelco Dolstra
Also, fetchGit now runs in O(1) memory since we pipe the output of 'git archive' directly into unpackTarball() (rather than first reading it all into memory).
2019-11-26Move code aroundEelco Dolstra
2019-11-26Move code aroundEelco Dolstra
2019-11-26More Rust FFI adventuresEelco Dolstra
We can now convert Rust Errors to C++ exceptions. At the Rust->C++ FFI boundary, Result<T, Error> will cause Error to be converted to and thrown as a C++ exception.
2019-11-26Rust cleanupEelco Dolstra
2019-11-26Make <nix/unpack-channel.nix> a builtin builderEelco Dolstra
This was the last function using a shell script, so this allows us to get rid of tar, coreutils, bash etc.
2019-11-26Enable Rust code to call C++ Source objectsEelco Dolstra
2019-11-26Add some Rust codeEelco Dolstra
2019-11-26Fix macOS buildEelco Dolstra
https://hydra.nixos.org/build/107457009
2019-11-26Fix clang warningsEelco Dolstra
2019-11-26Merge pull request #3141 from xbreak/nocafileEelco Dolstra
Downloader: Log configured CA file
2019-11-26Merge pull request #3144 from matthewbauer/fix-sandbox-fallbackEelco Dolstra
Fix sandbox fallback settings
2019-11-26SimplifyEelco Dolstra
2019-11-26Merge branch 'repair-bad-links' of https://github.com/chkno/nixEelco Dolstra
2019-11-26Merge pull request #3238 from puckipedia/attrset-overrides-dynamicEelco Dolstra
Ensure enough space in attrset bindings
2019-11-26Disallow empty store path namesEelco Dolstra
Fixes #3239.
2019-11-26DohEelco Dolstra
2019-11-26Add feature to disable URL literalsEelco Dolstra
E.g. $ nix-build '<nixpkgs>' -A hello --experimental-features no-url-literals error: URL literals are disabled, at /nix/store/vsjamkzh15r3c779q2711az826hqgvzr-nixpkgs-20.03pre194957.bef773ed53f/nixpkgs/pkgs/top-level/all-packages.nix:1236:11 Helps with implementing https://github.com/NixOS/rfcs/pull/45.
2019-11-25Ensure enough space in attrset bindings when using both __overrides and ↵Puck Meerburg
dynamic attributes
2019-11-22Turn NIX_PATH into a config settingEelco Dolstra
This allows it to be set in nix.conf.
2019-11-22Provide a default value for NIX_PATHEelco Dolstra
2019-11-22getEnv(): Return std::optionalEelco Dolstra
This allows distinguishing between an empty value and no value.
2019-11-15Check for and repair bad .links entriesChuck
A corrupt entry in .links prevents adding a fixed version of that file to the store in any path. The user experience is that corruption present in the store 'spreads' to new paths added to the store: (With store optimisation enabled) 1. A file in the store gets corrupted somehow (eg: filesystem bug). 2. The user tries to add a thing to the store which contains a good copy of the corrupted file. 3. The file being added to the store is hashed, found to match the bad .links entry, and is replaced by a link to the bad .links entry. (The .links entry's hash is not verified during add -- this would impose a substantial performance burden.) 4. The user observes that the thing in the store that is supposed to be a copy of what they were trying to add is not a correct copy -- some files have different contents! Running "nix-store --verify --check-contents --repair" does not fix the problem. This change makes "nix-store --verify --check-contents --repair" fix this problem. Bad .links entries are simply removed, allowing future attempts to insert a good copy of the file to succeed.
2019-11-13TypoEelco Dolstra
2019-11-11Merge pull request #3219 from Ericson2314/semicolonsEelco Dolstra
Fix extra semicolons warnings
2019-11-10Clean up semicolon and commaJohn Ericson
Thanks @bhipple for catching!
2019-11-10Remove unneeded semicolonsJohn Ericson
2019-11-10Fix extra ; warnings involving MakeErrorJohn Ericson