Commit graph

15467 commits

Author SHA1 Message Date
Eelco Dolstra 50aae0a14c FSAccessor: Make the fileSize and narOffset fields optional
The narOffset field only applies to NAR accessors. The fileSize field
may be too expensive to compute for certain accessors (e.g. libgit).
2023-11-01 15:39:40 +01:00
Eelco Dolstra 5381123879 Unify DirEntries types 2023-11-01 15:33:35 +01:00
Eelco Dolstra cdb27c1519 SourceAccessor: Change the main interface from lstat() to maybeLstat() 2023-11-01 15:26:07 +01:00
Eelco Dolstra 8ffd1695ce Unify FSAccessor::Type and SourceAccessor::Type 2023-11-01 14:43:20 +01:00
John Ericson 6132ffd825
Merge pull request #9266 from hercules-ci/doc-hacking-clangd-fix-tests
doc/hacking: Fix clangd for tests
2023-11-01 09:38:43 -04:00
John Ericson 0707db2b1c
Merge pull request #9255 from NixOS/libfetcher-docs-json
libfetcher doc automation
2023-11-01 09:38:02 -04:00
Eelco Dolstra b2ac6fc040 Remove FSAccessor::Type::tMissing
Instead stat() now returns std::nullopt to denote that the file
doesn't exist.
2023-11-01 14:36:40 +01:00
Robert Hensing bc4a1695ac doc/hacking: Fix clangd for tests 2023-11-01 11:44:16 +01:00
John Ericson 1093d6585f Make ParseSink a bit better
I wouldn't call it *good* yet, but this will do for now.

- `RetrieveRegularNARSink` renamed to `RegularFileSink` and moved
  accordingly because it actually has nothing to do with NARs in
  particular.

  - its `fd` field is also marked private

- `copyRecursive` introduced to dump a `SourceAccessor` into a
  `ParseSink`.

- `NullParseSink` made so `ParseSink` no longer has sketchy default
  methods.

This was done while updating #8918 to work with the new
`SourceAccessor`.
2023-11-01 02:36:43 -04:00
John Ericson e3febfcd53
Merge pull request #6258 from obsidiansystems/gcc-bug-ergonomics
Remove bug-avoiding `StoreConfig *` casts for settings
2023-10-31 12:48:27 -04:00
John Ericson b2cae33aef Remove bug-avoiding StoreConfig * casts for settings
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431 has been fixed, and
per the previous commit we now check that is the case at build time.
2023-10-31 12:09:46 -04:00
John Ericson 1f4525531e Add configure test to ensure GCC bug is fixed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431

(test is adapted from issue, test does not test for GCC-specific
behavior but rather absence of bug, so test is good with other compilers
too.)
2023-10-31 12:09:46 -04:00
Théophane Hufschmitt 12a0ae73db
Merge pull request #8817 from iFreilicht/flake-update-lock-overhaul
Overhaul `nix flake update` and `nix flake lock` UX
2023-10-31 16:19:05 +01:00
Eelco Dolstra f8da50644c
Merge pull request #9256 from NixOS/dependabot/github_actions/zeebe-io/backport-action-2.0.0
build(deps): bump zeebe-io/backport-action from 1.4.0 to 2.0.0
2023-10-31 16:07:25 +01:00
Eelco Dolstra 0c5eac9c45 Git fetcher: Handle submodules for workdirs 2023-10-31 15:59:25 +01:00
Felix Uhl f282ef5a56 fix: segfault in positional arg completion
Adding the inputPath as a positional feature uncovered this bug.
As positional argument forms were discarded from the `expectedArgs`
list, their closures were not. When the `.completer` closure was then
called, part of the surrounding object did not exist anymore.

This didn't cause an issue before, but with the new call to
`getEvalState()` in the "inputs" completer in nix/flake.cc, a segfault
was triggered reproducibly on invalid memory access to the `this`
pointer, which was always 0.

The solution of splicing the argument forms into a new list to extend
their lifetime is a bit of a hack, but I was unable to get the "nicer"
iterator-based solution to work.
2023-10-31 15:33:57 +01:00
Felix Uhl c7dcdb8325 Overhaul nix flake update and lock commands
Closes #5110
2023-10-31 15:33:57 +01:00
Felix Uhl c762b65dc5 Fix documentation of flake command output 2023-10-31 15:33:57 +01:00
Felix Uhl 1fd0867389 Fix missing output when creating lockfile 2023-10-31 15:33:50 +01:00
Eelco Dolstra 669b074f51 Cleanup 2023-10-31 14:52:21 +01:00
Eelco Dolstra d88106df24 Git fetcher: Improve submodule handling
Instead of making a complete copy of the repo, fetching the
submodules, and writing the result to the store (which is all
superexpensive), we now fetch the submodules recursively using the Git
fetcher, and return a union accessor that "mounts" the accessors for
the submodules on top of the root accessor.
2023-10-31 14:52:21 +01:00
Eelco Dolstra ee36a44bf2 GitInputScheme: Use libgit2
This replaces most calls to the "git" binary with libgit2.
2023-10-31 14:52:21 +01:00
Eelco Dolstra 1d0e3d84b6 Provide a InputScheme::fetch() built on top of InputScheme::getAccessor()
This is for graceful migration to lazy-trees fetchers (which are all
accessor-based). Eventually fetch() will be removed.
2023-10-31 14:52:17 +01:00
Eelco Dolstra e1b8442fa1 Fetcher cache: Add support for caching facts not related to store paths 2023-10-31 14:51:39 +01:00
Eelco Dolstra fa6bc33604
Merge pull request #9239 from edolstra/putFile
Input: Replace markFileChanged() by putFile()
2023-10-31 14:49:42 +01:00
dependabot[bot] 95f3f9eac9
build(deps): bump zeebe-io/backport-action from 1.4.0 to 2.0.0
Bumps [zeebe-io/backport-action](https://github.com/zeebe-io/backport-action) from 1.4.0 to 2.0.0.
- [Release notes](https://github.com/zeebe-io/backport-action/releases)
- [Commits](https://github.com/zeebe-io/backport-action/compare/v1.4.0...v2.0.0)

---
updated-dependencies:
- dependency-name: zeebe-io/backport-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-30 22:21:34 +00:00
Eelco Dolstra 05316d401f Cleanup 2023-10-30 17:03:06 +01:00
John Ericson 077de2968e Include fetcher input scheme info in the CLI dump
Leverages the previous commit.
2023-10-30 10:30:59 -04:00
John Ericson 8381eeda6f Systematize fetcher input attribute validation
We now have `schemeName` and `allowedAttrs` functions for this purpose.
We look up the schema with the former; we restrict the set of input
attributes with the latter.
2023-10-30 10:17:24 -04:00
Valentin Gagarin 325db01d26 fix anchor in conf-file
I inadvertently switched it to `opt-` when refactoring, but it should
have been `conf` to begin with.
2023-10-27 07:30:24 +02:00
John Ericson a6e587923c
Merge pull request #9247 from obsidiansystems/derivation-test-with-files
Turn derivation unit tests into unit characterization tests
2023-10-26 18:39:00 -04:00
John Ericson a419b61497 Turn derivation unit tests into unit characterization tests
The brings a number of advantages, including:

- Easier to update test data if design changes (and I do think our
  derivation JSON is not yet complaint with the guidelines).

- Easier to reuse test data in other implementations, inching closer to
  compliance tests for Nix *the concept* rather than any one
  implementation.
2023-10-26 18:09:01 -04:00
John Ericson 232e236672
Merge pull request #9246 from trofi/clarify-builder-uid-exhaustion
local-derivation-goal.cc: slightly clarify waiting message
2023-10-26 16:31:49 -04:00
Sergei Trofimovich e69c764708 local-derivation-goal.cc: slightly clarify waiting message
Before the change builder ID exhaustion printed the following message:

    [0/1 built] waiting for UID to build '/nix/store/hiy9136x0iyib4ssh3w3r5m8pxjnad50-python3.11-breathe-4.35.0.drv'

After the change it should be:

    [0/1 built] waiting for a free build user ID for '/nix/store/hiy9136x0iyib4ssh3w3r5m8pxjnad50-python3.11-breathe-4.35.0.drv'
2023-10-26 20:54:21 +01:00
John Ericson 1dc6a65d36
Merge pull request #9238 from tfc/small-improvements2
Small improvements 2
2023-10-26 09:35:03 -04:00
Jacek Galowicz 28c39c370c Provide default value for id to fix warning 2023-10-26 09:47:40 +02:00
Jacek Galowicz b66381e8d8 Use using instead of typedef 2023-10-26 09:47:40 +02:00
Silvan Mosberger 46028ff764
doc: Fix fetchGit default name (#9241) 2023-10-26 07:05:48 +02:00
John Ericson bfd51a4137
Merge pull request #9235 from fricklerhandwerk/doc-style-guide
add notes on comments in code samples
2023-10-25 15:32:07 -04:00
Eelco Dolstra 622191c2b5
Merge pull request #8965 from Artturin/bindfilesinchroot
Bindmount files instead of hardlinking or copying to chroot
2023-10-25 19:10:03 +02:00
Eelco Dolstra 15c430f389 Remove unused LockFile::write() 2023-10-25 18:44:09 +02:00
Eelco Dolstra 95d657c8b3 Input: Replace markFileChanged() by putFile()
Committing a lock file using markFileChanged() required the input to
be writable by the caller in the local filesystem (using the path
returned by getSourcePath()). putFile() abstracts over this.
2023-10-25 18:30:29 +02:00
John Ericson 5ac87a75dd
Merge pull request #9229 from tfc/small-improvements
Remove warnings, small improvements
2023-10-25 10:50:46 -04:00
Théophane Hufschmitt d571f17ff1
Merge pull request #9237 from iFreilicht/clarify-flake-implicit-types
docs: clarify flake types and implied defaults
2023-10-25 16:13:47 +02:00
Jacek Galowicz f555c98a34 Improve loop over gid container 2023-10-25 16:10:35 +02:00
Felix Uhl 7bc45c6136 docs: clarify flake types and implied defaults 2023-10-25 15:10:35 +02:00
Valentin Gagarin 00c90eae95 add note on highlighting examples and syntax definitions 2023-10-25 12:04:03 +02:00
Valentin Gagarin 78278f2b3f add notes on comments in code samples 2023-10-25 12:00:56 +02:00
Eelco Dolstra 3ca0dade5b
Merge pull request #9212 from trofkm/args-refactoring
Clean up `args.hh`
2023-10-25 10:33:53 +02:00
Valentin Gagarin 8d9e0b7aed
document the store concept (#9206)
* document the store concept and its purpose

reword the glossary to link to more existing information instead of
repeating it.

move the store documentation to the top of the table of contents, in
front of the Nix language. this will provide a natural place to
document other aspects of the store as well as the various store types.

move the package management section after the Nix language and before
Advanced Topics to follow the pattern to layer more complex concepts on
top of each other.

this structure of the manual will also nudge beginners to learn Nix
bottom-up and hopefully make more likely that they understand underlying
concepts first before delving into complex use cases that may or may not
be easy to implement with what's currently there.

[John adds this note] The sort of beginner who likes to dive straight into reference documentation should prefer this approach. Conversely, the sort of beginner who would prefer the opposite top-down approach of trying to solve problems before they understand everything that is going on is better off reading other tutorial/guide material anyways, and will just "random-access" the reference manual as a last resort. For such random-access the order doesn't matter, so this restructure doesn't make them any worse off.

Co-authored-by: John Ericson <git@JohnEricson.me>
2023-10-25 02:28:35 +00:00