aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2022-03-09BuildResult: Use DerivedPathEelco Dolstra
2022-03-08Add Store::buildPathsWithResults()Eelco Dolstra
This function is like buildPaths(), except that it returns a vector of BuildResults containing the exact statuses and output paths of each derivation / substitution. This is convenient for functions like Installable::build(), because they then don't need to do another series of calls to get the outputs of CA derivations. It's also a precondition to impure derivations, where we *can't* query the output of those derivations since they're not stored in the Nix database. Note that PathSubstitutionGoal can now also return a BuildStatus.
2022-03-07StyleEelco Dolstra
2022-03-07Merge branch 'GuillaumeDesforges/issue6192' of ↵Eelco Dolstra
https://github.com/GuillaumeDesforges/nix
2022-03-07Merge branch 'cli-suggestions' of https://github.com/thufschmitt/nixEelco Dolstra
2022-03-07Explicit error in flake init/new when not in storeGuillaume Desforges
2022-03-07Merge `or-suggestions.hh` into `suggestions.hh`regnat
No real need for keeping a separate header for such a simple class. This requires changing a bit `OrSuggestions<T>::operator*` to not throw an `Error` to prevent a cyclic dependency. But since this error is only thrown on programmer error, we can replace the whole method by a direct call to `std::get` which will raise its own assertion if needs be.
2022-03-07dupStringWithLen -> makeImmutableStringRobert Hensing
Refactor the `size == 0` logic into a new helper function that replaces dupStringWithLen. The name had to change, because unlike a `dup`-function, it does not always allocate a new string.
2022-03-07Value::mkPath: Avoid potential crash from null string_viewRobert Hensing
2022-03-07Value::mkString: Avoid crash from null string_viewRobert Hensing
2022-03-07Implement `operator<<` for Suggestionsregnat
That way there’s no need to explicitely convert it to a string when printing it
2022-03-07Move OrSuggestions to its own headerregnat
Prevents a recursive inclusion
2022-03-07Also display suggestions for the commands using the eval cacheregnat
Make `nix build .#nix-armv8l-linux` work for example
2022-03-07Add some tests for the suggestionsregnat
2022-03-07Implement a suggestions mechanismregnat
Each `Error` class now includes a set of suggestions, and these are printed by the top-level handler.
2022-03-07Merge pull request #6029 from Ma27/nix-log-ssh-ngThéophane Hufschmitt
ssh-ng: also store build logs to make them accessible by `nix log`
2022-03-06Point to new github oauth docs urlNicholas Sielicki
Previous URL was 404'ing.
2022-03-03Factor out a `GcStore` interfaceJohn Ericson
Starts progress on #5729. The idea is that we should not have these default methods throwing "unimplemented". This is a small step in that direction. I kept `addTempRoot` because it is a no-op, rather than failure. Also, as a practical matter, it is called all over the place, while doing other tasks, so the downcasting would be annoying. Maybe in the future I could move the "real" `addTempRoot` to `GcStore`, and the existing usecases use a `tryAddTempRoot` wrapper to downcast or do nothing, but I wasn't sure whether that was a good idea so with a bias to less churn I didn't do it yet.
2022-03-03Be more aggressive in hiding repeated valuesEelco Dolstra
We now memoize on Bindings / list element vectors rather than Values, so that e.g. two Values that point to the same Bindings will be printed only once.
2022-03-03printValue(): Don't show repeated valuesEelco Dolstra
Fixes #6157.
2022-03-03Fix segfault in headerCallback()Eelco Dolstra
https://hydra.nixos.org/build/168594664
2022-03-03Use C++11-style initializerEelco Dolstra
Co-authored-by: John Ericson <git@JohnEricson.me>
2022-03-02Add EvalState::coerceToStorePath() helperEelco Dolstra
This is useful whenever we want to evaluate something to a store path (e.g. in get-drvs.cc). Extracted from the lazy-trees branch (where we can require that a store path must come from a store source tree accessor).
2022-03-02nix profile: Support CA derivationsEelco Dolstra
2022-03-02Move installables-related operationsEelco Dolstra
2022-03-02StyleEelco Dolstra
2022-03-02Remove stray debug lineEelco Dolstra
2022-03-02Merge pull request #6189 from obsidiansystems/build-result-headerEelco Dolstra
Move `BuildResult` defintion to its own header
2022-03-01filterANSIEscapes: Ignore BEL characterAnders Kaseorg
GCC is not as good at music as it seems to think it is. Fixes #4546. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-03-01Move `BuildResult` defintion to its own headerJohn Ericson
Just like we did for `ValidPathInfo` in d92d4f85a5c8a2a2385c084500a8b6bd54b54e6c.
2022-03-01Merge pull request #6185 from hercules-ci/fetchTree-reuse-local-pathsEelco Dolstra
fetchTree: Use isValidPath, add comment
2022-03-01fetchTree: Use isValidPath, add commentRobert Hensing
2022-03-01fetch{url,Tarball}: Remove 'narHash' attributeEelco Dolstra
This was introduced in #6174. However fetch{url,Tarball} are legacy and we shouldn't have an undocumented attribute that does the same thing as one that already exists ('sha256').
2022-03-01Merge pull request #6183 from obsidiansystems/sort-configEelco Dolstra
Move some stuff from `Settings` to a new `FetchSettings`.
2022-03-01Move some stuff from `Settings` to a new `FetchSettings`.John Ericson
Starting work on #5638 The exact boundary between `FetchSettings` and `EvalSettings` is not clear to me, but that's fine. First lets clean out `libstore`, and then worry about what, if anything, should be the separation between those two.
2022-02-28Add EvalState::allowAndSetStorePathString helperRobert Hensing
This switches addPath from `printStorePath` to `toRealPath`.
2022-02-28fetchTree: Do not re-fetch paths already presentRobert Hensing
2022-02-28logging.hh: json.hpp -> json_fwd.hppMaximilian Bosch
2022-02-28libstore/build: add a few explanatory comments; simplifyMaximilian Bosch
2022-02-28libstore/derivation-goal: avoid double-parsing of JSON messagesMaximilian Bosch
To avoid that JSON messages are parsed twice in case of remote builds with `ssh-ng://`, I split up the original `handleJSONLogMessage` into three parts: * `parseJSONMessage(const std::string&)` checks if it's a message in the form of `@nix {...}` and tries to parse it (and prints an error if the parsing fails). * `handleJSONLogMessage(nlohmann::json&, ...)` reads the fields from the message and passes them to the logger. * `handleJSONLogMessage(const std::string&, ...)` behaves as before, but uses the two functions mentioned above as implementation. In case of `ssh-ng://`-logs the first two methods are invoked manually.
2022-02-28ssh-ng: also store build logs to make them accessible by `nix log`Maximilian Bosch
Right now when building a derivation remotely via $ nix build -j0 -f . hello -L --builders 'ssh://builder' it's possible later to read through the entire build-log by running `nix log -f . hello`. This isn't possible however when using `ssh-ng` rather than `ssh`. The reason for that is that there are two different ways to transfer logs in Nix through e.g. an SSH tunnel (that are used by `ssh`/`ssh-ng` respectively): * `ssh://` receives its logs from the fd pointing to `builderOut`. This is directly passed to the "log-sink" (and to the logger on each `\n`), hence `nix log` works here. * `ssh-ng://` however expects JSON-like messages (i.e. `@nix {log data in here}`) and passes it directly to the logger without doing anything with the `logSink`. However it's certainly possible to extract log-lines from this format as these have their own message-type in the JSON payload (i.e. `resBuildLogLine`). This is basically what I changed in this patch: if the code-path for `builderOut` is not reached and a `logSink` is initialized, the message was successfully processed by the JSON logger (i.e. it's in the expected format) and the line is of the expected type (i.e. `resBuildLogLine`), the line will be written to the log-sink as well. Closes #5079
2022-02-28Fix clang warningEelco Dolstra
2022-02-28Fix Darwin buildEelco Dolstra
Fixes #6169
2022-02-28Merge pull request #6072 from Ma27/fix-nix-why-depends-non-preciseThéophane Hufschmitt
nix/why-depends: fix output when not using `--precise`
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-25xml-writer: Remove std aliasesEelco Dolstra
2022-02-25refactor: remove verbose-build from docsKevin Amado
- From what I see it is an implementation detail but is no longer configurable from the settings
2022-02-25ExprAttrs::show(): Show attrs in sorted orderEelco Dolstra
Issue #6160.
2022-02-24Merge pull request #6089 from edolstra/dot-defaultEelco Dolstra
Replace defaultBla.$system with bla.$system.default
2022-02-24libfetchers: Rename immutable -> lockedEelco Dolstra
This is more consistent with flake terminology.