aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-08-23Add introductory sentence to advanced topics (#8861)Uri Zafrir
2023-08-22Tarball trees: Propagate lastModifiedEelco Dolstra
This makes them behave consistently with GitHub/GitLab flakes.
2023-08-22Merge pull request #8857 from ↵Eelco Dolstra
NixOS/dependabot/github_actions/zeebe-io/backport-action-1.4.0 Bump zeebe-io/backport-action from 1.3.1 to 1.4.0
2023-08-21Bump zeebe-io/backport-action from 1.3.1 to 1.4.0dependabot[bot]
Bumps [zeebe-io/backport-action](https://github.com/zeebe-io/backport-action) from 1.3.1 to 1.4.0. - [Release notes](https://github.com/zeebe-io/backport-action/releases) - [Commits](https://github.com/zeebe-io/backport-action/compare/v1.3.1...v1.4.0) --- updated-dependencies: - dependency-name: zeebe-io/backport-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
2023-08-21Merge pull request #8836 from obsidiansystems/rm-addToSearchPathEelco Dolstra
Delete `EvalState::addToSearchPath`
2023-08-19Merge pull request #8812 from tweag/fix-clang-tidyRobert Hensing
Fix some warnings/bugs found by clang-tidy
2023-08-18Delete `EvalState::addToSearchPath`John Ericson
This function is now trivial enough that it doesn't need to exist. `EvalState` can still be initialized with a custom search path, but we don't have a need to mutate the search path after it has been constructed, and I don't see why we would need to in the future. Fixes #8229
2023-08-18Merge pull request #8839 from obsidiansystems/string-context-7479John Ericson
Refactor Raw pattern, part of #7479
2023-08-18Fixing #7479John Ericson
Types converted: - `NixStringContextElem` - `OutputsSpec` - `ExtendedOutputsSpec` - `DerivationOutput` - `DerivationType` Existing ones mostly conforming the pattern cleaned up: - `ContentAddressMethod` - `ContentAddressWithReferences` The `DerivationGoal::derivationType` field had a bogus initialization, now caught, so I made it `std::optional`. I think #8829 can make it non-optional again because it will ensure we always have the derivation when we construct a `DerivationGoal`. See that issue (#7479) for details on the general goal. `git grep 'Raw::Raw'` indicates the two types I didn't yet convert `DerivedPath` and `BuiltPath` (and their `Single` variants) . This is because @roberth and I (can't find issue right now...) plan on reworking them somewhat, so I didn't want to churn them more just yet. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-08-18Merge pull request #8845 from cole-h/fix-double-percent-encodingEelco Dolstra
libutil: fix double-encoding of URLs
2023-08-18Merge pull request #8653 from hercules-ci/gitignore-.cacheRobert Hensing
.gitignore: Add .cache/
2023-08-18test/flakes/follow-paths.sh: QuoteRobert Hensing
Co-authored-by: Alex Ameen <alex.ameen.tx@gmail.com>
2023-08-18Merge pull request #8832 from hercules-ci/positive-source-filterJohn Ericson
Add positive source filter
2023-08-18Merge pull request #8840 from iFreilicht/tests-for-nix-replRobert Hensing
Add tests for repl formatting with and without :p
2023-08-17libutil: fix double-encoding of URLsCole Helbling
If you have a URL that needs to be percent-encoded, such as `http://localhost:8181/test/+3d.tar.gz`, and try to lock that in a Nix flake such as the following: { inputs.test = { url = "http://localhost:8181/test/+3d.tar.gz"; flake = false; }; outputs = { test, ... }: { t = builtins.readFile test; }; } running `nix flake metadata` shows that the input URL has been incorrectly double-encoded (despite the flake.lock being correctly encoded only once): [...snip...] Inputs: └───test: http://localhost:8181/test/%252B3d.tar.gz?narHash=sha256-EFUdrtf6Rn0LWIJufrmg8q99aT3jGfLvd1//zaJEufY%3D (Notice the `%252B`? That's just `%2B` but percent-encoded again) With this patch, the double-encoding is gone; running `nix flake metadata` will show the proper URL: [...snip...] Inputs: └───test: http://localhost:8181/test/%2B3d.tar.gz?narHash=sha256-EFUdrtf6Rn0LWIJufrmg8q99aT3jGfLvd1//zaJEufY%3D --- As far as I can tell, this happens because Nix already percent-encodes the URL and stores this as the value of `inputs.asdf.url`. However, when Nix later tries to read this out of the eval state as a string (via `getStrAttr`), it has to run it through `parseURL` again to get the `ParsedURL` structure. Now, this itself isn't a problem -- the true problem arises when using `ParsedURL::to_string` later, which then _re-escapes the path_. It is at this point that what would have been `%2B` (`+`) becomes `%252B` (`%2B`).
2023-08-17libexpr/tests: test that parseFlakeRef doesn't percent-encode twiceCole Helbling
2023-08-17Test repl formatting with and without :pFelix Uhl
2023-08-16Merge pull request #8833 from hercules-ci/jobcategory-docEelco Dolstra
Document jobCategory()
2023-08-16Merge pull request #8825 from trofi/search-path-prefixEelco Dolstra
src/libexpr/search-path.cc: avoid out-of-bounds read on string_view
2023-08-16Document jobCategory()Robert Hensing
2023-08-16Add gc root for nixpkgs/lib contentRobert Hensing
2023-08-16GC root for fetched nixpkgs/lib contentRobert Hensing
2023-08-16Add positive source filterRobert Hensing
Source filtering is a really cool Nix feature that lets us avoid a lot of rebuilds, which speeds up the iteration cycle a lot in cases where the relevant source files aren't actually modified. We used to have a source filter that marked a few files as irrelevant, but this is the wrong approach, as we have many more files that are irrelevant. We may call this negative filtering. This commit switches the source filtering to positive filtering, which is a lot more robust. Instead of marking which files we don't need we marked the files that we do need. It's a superior approach because it is fail safe. Instead of allowing build performance problems to creep in over time, we require that all source inputs are declared. I shouldn't have to explain that declaring inputs is a good practice, so I'll stop over-explaining here. I do have to acknowledge that this will cause a build failure when the filter is incomplete. This is *good*, because it's the only realistic way we could be reminded of these problems. These events will be infrequent, so the small cost of extending the filter is worth it, compared to the hidden cost of longer dev cycles for things like tests, docker image, etc, etc. (Also rebuilding Nix for stupid unnecessary reasons makes my blood boil)
2023-08-15Update tests/flakes/follow-paths.shVertex
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-14src/libexpr/search-path.cc: avoid out-of-bounds read on string_viewSergei Trofimovich
Without the change build with `-D_GLIBCXX_ASSERTIONS` exposes testsuite assertion: $ gdb src/libexpr/tests/libnixexpr-tests Reading symbols from src/libexpr/tests/libnixexpr-tests... (gdb) break __glibcxx_assert_fail (gdb) run (gdb) bt in std::__glibcxx_assert_fail(char const*, int, char const*, char const*)@plt () from /mnt/archive/big/git/nix/src/libexpr/libnixexpr.so in std::basic_string_view<char, std::char_traits<char> >::operator[] (this=0x7fffffff56c0, __pos=4) at /nix/store/r74fw2j8rx5idb0w8s1s6ynwwgs0qmh9-gcc-14.0.0/include/c++/14.0.0/string_view:258 in nix::SearchPath::Prefix::suffixIfPotentialMatch (this=0x7fffffff5780, path=...) at src/libexpr/search-path.cc:15 in nix::SearchPathElem_suffixIfPotentialMatch_partialPrefix_Test::TestBody (this=0x555555a17540) at src/libexpr/tests/search-path.cc:62 As string sizes are usigned types `(a - b) > 0` effectively means `a != b`. While the intention should be `a > b`. The change fixes test suite pass.
2023-08-14Add release notes for the previous commitAlex Zero
2023-08-14Fix follow path checking at depths greater than 2Alex Zero
We need to recurse into the input tree to handle follows paths that trarverse multiple inputs that may or may not be follow paths themselves.
2023-08-14Merge pull request #8813 from obsidiansystems/outputOfRobert Hensing
Create (experimental) `outputOf` primop.
2023-08-14Create `outputOf` primop.John Ericson
In the Nix language, given a drv path, we should be able to construct another string referencing to one of its output. We can do this today with `(import drvPath).output`, but this only works for derivations we already have. With dynamic derivations, however, that doesn't work well because the `drvPath` isn't yet built: importing it like would need to trigger IFD, when the whole point of this feature is to do "dynamic build graph" without IFD! Instead, what we want to do is create a placeholder value with the right string context to refer to the output of the as-yet unbuilt derivation. A new primop in the language, analogous to `builtins.placeholder` can be used to create one. This will achieve all the right properties. The placeholder machinery also will match out the `outPath` attribute for CA derivations works. In 60b7121d2c6d4322b7c2e8e7acfec7b701b2d3a1 we added that type of placeholder, and the derived path and string holder changes necessary to support it. Then in the previous commit we cleaned up the code (inspiration finally hit me!) to deduplicate the code and expose exactly what we need. Now, we can wire up the primop trivally! Part of RFC 92: dynamic derivations (tracking issue #6316) Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-14Rework evaluator `SingleDerivedPath` infraJohn Ericson
`EvalState::mkSingleDerivedPathString` previously contained its own inverse (printing, rather than parsing) in order to validate what was parsed. Now that is pulled out into its own separate function: `EvalState::coerceToSingleDerivedPath`. In additional that pulled out logic is deduplicated with `EvalState::mkOutputString` via `EvalState::mkOutputStringRaw`, which is itself deduplicated (and generalized) with `DownstreamPlaceholder::mkOutputStringRaw`. All these changes make the unit tests simpler. (We would ideally write more unit tests for `mkSingleDerivedPathString` `coerceToSingleDerivedPath` directly, but we cannot yet do that because the IO in reading the store path won't work when the dummy store cannot hold anything. Someday we'll have a proper in-memory store which will work for this.) Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-14Rename `optOutputPath` to `optStaticOutputPath`John Ericson
This choice of variable name makes it more clear what is going on. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-08-11Merge pull request #8735 from obsidiansystems/defexprRobert Hensing
Factor out `nix-defexpr` path computation
2023-08-11initLibUtil: Add exception handling self-checkRobert Hensing
2023-08-11Merge pull request #8369 from obsidiansystems/inductive-derived-pathtomberek
Make the Derived Path family of types inductive for dynamic derivations
2023-08-11SimpleLogger::log: fix unintended fallthroughYorick van Pelt
2023-08-11FileTransfer::download: fix use-after-moveYorick van Pelt
std::move(state->data) and data.empty() were called in a loop, and could run with no other threads intervening. Accessing moved objects is undefined behavior, and could cause a crash.
2023-08-11MultiCommand::toJSON: Fix use-after-moveYorick van Pelt
2023-08-11Prevent overriding virtual methods that are called in a destructorYorick van Pelt
Virtual methods are no longer valid once the derived destructor has run. This means the compiler is free to optimize them to be non-virtual. Found using clang-tidy
2023-08-10Merge pull request #8622 from pwaller/issue-8615Théophane Hufschmitt
Try to realise CA derivations during queryMissing
2023-08-10Make the Derived Path family of types inductive for dynamic derivationsJohn Ericson
We want to be able to write down `foo.drv^bar.drv^baz`: `foo.drv^bar.drv` is the dynamic derivation (since it is itself a derivation output, `bar.drv` from `foo.drv`). To that end, we create `Single{Derivation,BuiltPath}` types, that are very similar except instead of having multiple outputs (in a set or map), they have a single one. This is for everything to the left of the rightmost `^`. `NixStringContextElem` has an analogous change, and now can reuse `SingleDerivedPath` at the top level. In fact, if we ever get rid of `DrvDeep`, `NixStringContextElem` could be replaced with `SingleDerivedPath` entirely! Important note: some JSON formats have changed. We already can *produce* dynamic derivations, but we can't refer to them directly. Today, we can merely express building or example at the top imperatively over time by building `foo.drv^bar.drv`, and then with a second nix invocation doing `<result-from-first>^baz`, but this is not declarative. The ethos of Nix of being able to write down the full plan everything you want to do, and then execute than plan with a single command, and for that we need the new inductive form of these types. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-08-09Try to realise CA derivations during queryMissingPeter Waller
This enables nix to correctly report what will be fetched in the case that everything is a cache hit. Note however that if an intermediate build of something which is not cached could still cause products to end up being substituted if the intermediate build results in a CA path which is in the cache. Fixes #8615. Signed-off-by: Peter Waller <p@pwaller.net>
2023-08-08Merge pull request #8805 from tweag/fix-add-to-store-existingThéophane Hufschmitt
[V2] Fix misread of source if path is already valid
2023-08-08Test the parallel copy over ssh-ngThéophane Hufschmitt
Regression test for https://github.com/NixOS/nix/issues/6253
2023-08-07Merge pull request #8786 from Ma27/fix-why-depends-preciseEelco Dolstra
nix/why-depends: fix output of `--precise`
2023-08-07Merge pull request #8322 from tweag/stabilize-discard-referencesThéophane Hufschmitt
Stabilize `discard-references`
2023-08-07Merge pull request #8769 from edolstra/generalize-tarball-urlsEelco Dolstra
Don't require .tar/.zip extension for tarball flakerefs
2023-08-07Stabilize `discard-references`Théophane Hufschmitt
It has been there for a few releases now (landed in 2.14.0), doesn't seem to cause any major issue and is wanted in a few places (https://github.com/NixOS/nix/pull/7087#issuecomment-1544471346).
2023-08-07Merge pull request #8692 from obsidiansystems/add-another-xp-checkThéophane Hufschmitt
Feature gate `DownstreamPlaceholder::unknownCaOutput`
2023-08-07Fix misread of source if path is already validSimon Rainerson
When receiving a stream of NARs through the ssh-ng protocol, an already existing path would cause the NAR archive to not be read in the stream, resulting in trying to parse the NAR as a ValidPathInfo. This results in the error message: error: not an absolute path: 'nix-archive-1' Fixes #6253 Usually this problem is avoided by running QueryValidPaths before AddMultipleToStore, but can arise when two parallel nix processes gets the same response from QueryValidPaths. This makes the problem more prominent when running builds in parallel.
2023-08-06Merge pull request #8760 from iFreilicht/fix-json-load-assertion-errorsJohn Ericson
Fix derivation load assertion errors