aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2023-04-25FormattingEelco Dolstra
2023-04-24Merge remote-tracking branch 'origin/master' into source-pathEelco Dolstra
2023-04-21Use `std::set<StringContextElem>` not `PathSet` for string contextsJohn Ericson
Motivation `PathSet` is not correct because string contexts have other forms (`Built` and `DrvDeep`) that are not rendered as plain store paths. Instead of wrongly using `PathSet`, or "stringly typed" using `StringSet`, use `std::std<StringContextElem>`. ----- In support of this change, `NixStringContext` is now defined as `std::std<StringContextElem>` not `std:vector<StringContextElem>`. The old definition was just used by a `getContext` method which was only used by the eval cache. It can be deleted altogether since the types are now unified and the preexisting `copyContext` function already suffices. Summarizing the previous paragraph: Old: - `value/context.hh`: `NixStringContext = std::vector<StringContextElem>` - `value.hh`: `NixStringContext Value::getContext(...)` - `value.hh`: `copyContext(...)` New: - `value/context.hh`: `NixStringContext = std::set<StringContextElem>` - `value.hh`: `copyContext(...)` ---- The string representation of string context elements no longer contains the store dir. The diff of `src/libexpr/tests/value/context.cc` should make clear what the new representation is, so we recommend reviewing that file first. This was done for two reasons: Less API churn: `Value::mkString` and friends did not take a `Store` before. But if `NixStringContextElem::{parse, to_string}` *do* take a store (as they did before), then we cannot have the `Value` functions use them (in order to work with the fully-structured `NixStringContext`) without adding that argument. That would have been a lot of churn of threading the store, and this diff is already large enough, so the easier and less invasive thing to do was simply make the element `parse` and `to_string` functions not take the `Store` reference, and the easiest way to do that was to simply drop the store dir. Space usage: Dropping the `/nix/store/` (or similar) from the internal representation will safe space in the heap of the Nix programming being interpreted. If the heap contains many strings with non-trivial contexts, the saving could add up to something significant. ---- The eval cache version is bumped. The eval cache serialization uses `NixStringContextElem::{parse, to_string}`, and since those functions are changed per the above, that means the on-disk representation is also changed. This is simply done by changing the name of the used for the eval cache from `eval-cache-v4` to eval-cache-v5`. ---- To avoid some duplication `EvalCache::mkPathString` is added to abstract over the simple case of turning a store path to a string with just that string in the context. Context This PR picks up where #7543 left off. That one introduced the fully structured `NixStringContextElem` data type, but kept `PathSet context` as an awkward middle ground between internal `char[][]` interpreter heap string contexts and `NixStringContext` fully parsed string contexts. The infelicity of `PathSet context` was specifically called out during Nix team group review, but it was agreeing that fixing it could be left as future work. This is that future work. A possible follow-up step would be to get rid of the `char[][]` evaluator heap representation, too, but it is not yet clear how to do that. To use `NixStringContextElem` there we would need to get the STL containers to GC pointers in the GC build, and I am not sure how to do that. ---- PR #7543 effectively is writing the inverse of a `mkPathString`, `mkOutputString`, and one more such function for the `DrvDeep` case. I would like that PR to have property tests ensuring it is actually the inverse as expected. This PR sets things up nicely so that reworking that PR to be in that more elegant and better tested way is possible. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2023-04-18Merge pull request #8220 from accelbread/whitelist-commit-lockfile-summaryRobert Hensing
Add commit-lockfile-summary to flake nixConfig whitelist
2023-04-17Merge pull request #3746 from obsidiansystems/path-infoRobert Hensing
Introduce `StoreReferences` and `ContentAddressWithReferences`
2023-04-17Merge remote-tracking branch 'upstream/master' into source-pathRobert Hensing
2023-04-17Merge pull request #8193 from hercules-ci/dry-stringsRobert Hensing
Deduplicate string literal rendering, fix 4909
2023-04-16libexpr: Move identifier-like printing to print.ccRobert Hensing
2023-04-16libexpr/value/print.* -> libexpr/print.*Robert Hensing
Generalizes the file to sensibly allow printing any part of the language syntax.
2023-04-16printLiteral: Do not overloadRobert Hensing
2023-04-15FormatRobert Hensing
Co-authored-by: Eelco Dolstra <edolstra@gmail.com> Co-authored-by: John Ericson <git@JohnEricson.me>
2023-04-14Whitelist commit-lockfile-summary in flake nixConfigArchit Gupta
2023-04-11Merge pull request #8170 from tweag/fix-aarch64-buildEelco Dolstra
Explicitely define `LockFile::operator!=`
2023-04-09Deduplicate string literal rendering, fix 4909Robert Hensing
2023-04-07Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2023-04-07Merge pull request #8179 from tweag/disable-gc-on-coroutineRobert Hensing
disable gc on coroutine
2023-04-07Finish converting existing comments for internal API docs (#8146)John Ericson
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
2023-04-07Add talkative msg for coro gc debugYorick van Pelt
2023-04-07Always disable GC in a coroutine unless the patch is appliedYorick van Pelt
2023-04-07DisableGC: replace by CoroutineContext, std::shared_ptr<void>Yorick van Pelt
2023-04-07Disable GC inside coroutines on mac OSYorick van Pelt
2023-04-07TypoEelco Dolstra
2023-04-06Origin: Use SourcePathEelco Dolstra
2023-04-06Backport SourcePath from the lazy-trees branchEelco Dolstra
This introduces the SourcePath type from lazy-trees as an abstraction for accessing files from inputs that may not be materialized in the real filesystem (e.g. Git repositories). Currently, however, it's just a wrapper around CanonPath, so it shouldn't change any behaviour. (On lazy-trees, SourcePath is a <InputAccessor, CanonPath> tuple.)
2023-04-05Explicitely define `LockFile::operator!=`Théophane Hufschmitt
It should be syntethised in terms of `operator==`, but the GCC version used on aarch64-linux doesn't implement that (see https://hydra.nixos.org/build/214848896=. So explicitely define it. Fix https://github.com/NixOS/nix/issues/8159
2023-04-03Merge pull request #8157 from hercules-ci/switch-bugsThéophane Hufschmitt
Fix current and future `switch` bugs
2023-04-03Merge pull request #8042 from lheckemann/alt-lockfilesEelco Dolstra
Allow specifying alternative paths for reading/writing flake locks
2023-04-03Enable -Werror=switch-enumRobert Hensing
switch statements must now match all enum values or disable the warning. Explicit is good. This has helped us find two bugs, after solving another one by debugging. From now on, adding to an enum will raise errors where they are not explicitly handled, which is good for productivity, and helps us decide the correct behavior in all usages. Notably still excluded from this though are the cases where the warning is disabled by local pragmas. fromTOML.cc did not build despite a top-level pragma, so I've had to resort to a makefile solution for that.
2023-04-03Allow open switch-enum in 5 placesRobert Hensing
2023-04-03Add explicit case statements where -Wswitch-enum would report themRobert Hensing
2023-04-03Merge pull request #8148 from ↵Robert Hensing
hercules-ci/fix-issue-8119-printValue-tBlackhole-abort eval: Fix crash on missing printValue tBlackhole case
2023-04-03eval: Fix crash on missing printValue tBlackhole caseRobert Hensing
Fixes #8119
2023-03-31Ensure all headers have `#pragma once` and are in API docsJohn Ericson
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
2023-03-30Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
Also improve content-address.hh API docs.
2023-03-30TypoEelco Dolstra
2023-03-30More precise wordingJoachim Breitner
2023-03-29Update src/libexpr/primops.ccJoachim Breitner
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-03-28Update src/libexpr/primops.ccJoachim Breitner
Co-authored-by: asymmetric <lorenzo@mailbox.org>
2023-03-28Docs: Explain why `import nixpkgs` works in flakesJoachim Breitner
2023-03-27Merge pull request #8073 from tweag/fix-root-channels-locationJohn Ericson
Fix root channels location
2023-03-27Merge pull request #7609 from obsidiansystems/hide-experimental-settingsJohn Ericson
Hide experimental settings
2023-03-23Factor out the generation of the profile/channel directoryThéophane Hufschmitt
Make sure that all the code paths use the same one, and that the backwards-compatibility measures are probably in place when needed
2023-03-21Fix rendering of fetchGit documentationEelco Dolstra
stripIndentation() doesn't support tabs, so the entire markdown ended up indented and thus rendered as a code block.
2023-03-20Move enabled experimental feature to libutil structJohn Ericson
This is needed in subsequent commits to allow the settings and CLI args infrastructure itself to read this setting.
2023-03-19Only allow reference lock files when allow-dirty is setLinus Heckemann
2023-03-14Apply review suggestionsLinus Heckemann
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-03-13Allow specifying alternative paths for reading/writing flake locksLinus Heckemann
This allows having multiple separate lockfiles for a single project, which can be useful for testing against different versions of nixpkgs; it also allows tracking custom input overrides for remote flakes without requiring local clones of these flakes. For example, if I want to build Nix against my locally pinned nixpkgs, and have a lock file tracking this override independently of future updates to said nixpkgs: nix flake lock --output-lock-file /tmp/nix-flake.lock --override-input nixpkgs flake:nixpkgs nix build --reference-lock-file /tmp/nix-flake.lock Co-Authored-By: Will Fancher <elvishjerricco@gmail.com>
2023-03-08Revert "Disable GC during coroutine execution + test"Théophane Hufschmitt
2023-03-08Merge pull request #7725 from yorickvP/check-coro-gcThéophane Hufschmitt
Disable GC during coroutine execution + test
2023-03-05remove indentation in `fetchGit` attribute listingValentin Gagarin
also reword a confusing sentence and add links to Git terminology