1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 21:01:16 +02:00
Commit graph

11813 commits

Author SHA1 Message Date
Eelco Dolstra
40e8c5f613 Fix possible deref of null git_config 2025-02-10 15:16:54 +01:00
Eelco Dolstra
1cb9a354fb Merge remote-tracking branch 'origin/master' into lfs 2025-02-10 14:46:01 +01:00
John Ericson
cafefed421 Rename to "content-address*ing* derivation"
"content-address*ed*" derivation is misleading because all derivations
are *themselves* content-addressed. What may or may not be
content-addressed is not derivation itself, but the *output* of the
derivation.

The outputs are not *part* of the derivation (for then the derivation
wouldn't be complete before we built it) but rather separate entities
produced by the derivation.

"content-adddress*ed*" is not correctly because it can only describe
what the derivation *is*, and that is not what we are trying to do.

"content-address*ing*" is correct because it describes what the
derivation *does* --- it produces content-addressed data.
2025-02-10 01:12:56 -05:00
John Ericson
e80d333777
Document Store Derivations and Deriving Paths (#12290)
This is a big step documenting the store layer on its own, separately from the evaluator (and `builtins.derivation`).

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-02-10 01:30:07 +00:00
MaxHearnden
12d2527276 Set FD_CLOEXEC on sockets created by curl
Curl creates sockets without setting FD_CLOEXEC/SOCK_CLOEXEC, this can
cause connections to remain open forever when using commands like `nix
shell`

This change sets the FD_CLOEXEC flag using a CURLOPT_SOCKOPTFUNCTION
callback.
2025-02-09 21:09:33 +00:00
Eelco Dolstra
7096acc74d Parser: Respect the accessor of the source file for relative paths
Previously we only returned paths in rootFS, which is wrong and only
worked because currently all our source trees are in rootFS.
2025-02-06 16:33:43 +01:00
Eelco Dolstra
6e2fcb7e29 Parser: Respect the accessor of the source file for relative paths 2025-02-06 16:31:42 +01:00
silvanshade
1f56ea4c72
Add BLAKE3 hashing algorithm
This uses the single-threaded C-based routines from libblake3.

This is not optimal performance-wise but should be a good starting point
for nix compatibility with BLAKE3 hashing until a more performant
implementation based on the multi-threaded BLAKE3 routines
(written in Rust) can be developed.
2025-02-05 17:49:15 -07:00
John Ericson
c98525235f Revert "Revert "Adapt scheduler to work with dynamic derivations""
This fixes dynamic derivations, reverting #9081.

I believe that this time around, #9052 is fixed. When I first rebased
this, tests were failing (which wasn't the case before). The cause of
those test failures were due to the crude job in which the outer goal
tried to exit with the inner goal's status.

Now, that error handling has been reworked to be more faithful. The exit
exit status and exception of the inner goal is returned by the outer
goal. The exception was what was causing the test failures, but I
believe it was not having the right error code (there is more than one
for failure) that caused #9081.

The only cost of doing things the "right way" was that I had to
introduce a hacky `preserveException` boolean. I don't like this, but,
then again, none of us like anything about how the scheduler works.
Issue #11927 is still there to clean everything up, subsuming the need
for any `preserveException` because I doubt we will be fishing
information out of state machines like this at all.

This reverts commit 8440afbed7.

Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
2025-02-05 17:26:32 -05:00
John Ericson
a562d0b6ce
Merge pull request #12386 from DeterminateSystems/git-fixes
Git fetcher: Don't create refs when fetching by revision
2025-02-05 15:18:58 -05:00
Eelco Dolstra
25fcc8d1ab Add inputs.self.submodules flake attribute
This allows a flake to specify that it needs Git submodules to be
enabled (or disabled, if we ever change the default) on the top-level
flake. This requires the input to be refetched, but since the first
fetch is lazy, this shouldn't be expensive.

Currently the only attribute allowed by `inputs.self` is `submodules`,
but more can be added in the future (e.g. a `lazy` attribute to opt in
to lazy tree behaviour).

Fixes #5312, #9842.
2025-02-04 21:16:33 +01:00
Eelco Dolstra
01598487b7 Add FIXME 2025-02-04 16:41:10 +01:00
Eelco Dolstra
c74ad6b32b Remove FlakeRef::fetchTree() 2025-02-04 16:26:22 +01:00
Eelco Dolstra
1ab97a70f5 fetchOrSubstituteTree(): Return an accessor
This prepares lazy access to flake.nix etc.
2025-02-04 16:14:34 +01:00
John Ericson
b3b741973e Inline inputsRealised 2025-02-03 13:15:49 -05:00
John Ericson
4b1753e661 Move repairClosure
This is necessary in order to inline `inputsRealised` in the next
commit by combing it with its adjacent function (i.e. with a small
diff).
2025-02-03 13:14:13 -05:00
John Ericson
2297cc0dab Inline getDerivation and loadDerivation 2025-02-03 13:13:04 -05:00
John Ericson
57463ab910 Inline closureRepaired 2025-02-03 13:13:04 -05:00
John Ericson
41274f3c3e Inline outputsSubstitutionTried 2025-02-03 13:13:04 -05:00
John Ericson
53946fe017 Narrow scope on some local variables 2025-02-03 13:13:04 -05:00
Leandro Reina
134530a534 Merge remote-tracking branch 'upstream/master' into lfs 2025-02-03 19:07:20 +01:00
mergify[bot]
24d11d22c3
Merge pull request #12286 from stevalkr/flakes_symlink_path
Fix flakes follow symlinks
2025-02-02 03:11:20 +00:00
mergify[bot]
340eae1f23
Merge pull request #12385 from DeterminateSystems/fix-git-workdir-path-display
Fix duplicate setPathDisplay()
2025-02-02 02:10:38 +00:00
mergify[bot]
b842103307
Merge pull request #12376 from DeterminateSystems/fetch-using-nar-hash
Allow fetching using NAR hash without --allow-dirty-locks
2025-02-02 02:10:35 +00:00
mergify[bot]
d5c00cfab1
Merge pull request #12387 from nix-windows/big-objs
Add mbig-obj flag to allow cross-compiling libexpr to mingw32
2025-02-02 01:32:15 +00:00
Steve Walker
453e8dc067 Fix flakes follow symlinks
Co-authored-by: Jan Christoph Bischko <jbischko@barracuda.com>
2025-02-02 08:30:04 +07:00
John Ericson
d949c8de7c
Merge pull request #12249 from nix-windows/stack-size
Remove broken stack size logic from Windows
2025-01-31 22:57:01 -05:00
Eelco Dolstra
9e240ecced Remove isConsideredLocked() 2025-01-31 17:03:27 +01:00
Eelco Dolstra
4113fdf2f0 Allow use of lock files with unlocked entries as long as they have a NAR hash
Fixes #12364.
2025-01-31 17:03:27 +01:00
Eelco Dolstra
5dec1dc086 fetchGit/fetchTree: Allow fetching using only a NAR hash
Fixes #12027.
2025-01-31 17:03:27 +01:00
Eelco Dolstra
5f6658b9c9 fetchTree: Distinguish between fetchGit and fetchTree consistently 2025-01-31 15:10:29 +01:00
Brian McKenna
26539a087f Add mbig-obj flag to allow cross-compiling libexpr to mingw32 2025-01-31 22:53:42 +11:00
Brian McKenna
7c8c71f8e9 Totally exclude nix::setStackSize on Windows 2025-01-31 21:11:45 +11:00
Eelco Dolstra
c8b22643ba readHead(): Make sure we're returning the HEAD ref line
If we previously fetched by revision, the output of "git ls-remote"
won't start with the expected line like

  ref: refs/heads/master HEAD

but will be something like

  5c4410e3b9891c05ab40d723de78c6f0be45ad30        refs/heads/5c4410e3b9891c05ab40d723de78c6f0be45ad30

This then causes Nix to treat that revision as a refname, which then
leads to warnings like

  warning: could not update cached head '5c4410e3b9891c05ab40d723de78c6f0be45ad30' for 'file:///tmp/repo'
2025-01-30 19:03:34 +01:00
Eelco Dolstra
ee9fa0d360 Git fetcher: Don't use refspec <rev>:<rev>
This causes Git to create a local ref named refs/head/<rev>, e.g.

  $ git -C ~/.cache/nix/gitv3/11irpim06vj4h6c0w8yls6kx4hvl0qd0gr1fvk47n76g6wf1s1vk ls-remote --symref .
  5c4410e3b9891c05ab40d723de78c6f0be45ad30        refs/heads/5c4410e3b9891c05ab40d723de78c6f0be45ad30
  7f6bde8a20de4cccc2256f088bc5af9dbe38881d        refs/heads/7f6bde8a20de4cccc2256f088bc5af9dbe38881d

which confuses readHead(), leading to errors like

  fatal: Refusing to point HEAD outside of refs/
  warning: could not update cached head 'd275d93aa0bb8a004939b2f1e87f559f989453be' for 'file:///tmp/repo'
2025-01-30 19:03:34 +01:00
Eelco Dolstra
9f72d5bce9 Git fetcher: Don't pass URL query parameters for file:// URLs
Git interprets them as part of the file name, so passing parameters
like 'rev' breaks. Only relevant for testing (when _NIX_FORCE_HTTP is
set) and local bare repos.
2025-01-30 19:03:34 +01:00
Eelco Dolstra
3032512425 GitExportIgnoreSourceAccessor: Don't show «unknown»
In general we should set the path display prefix on the inner
accessor, so we now pass the display prefix to getAccessor().
2025-01-30 12:41:02 +01:00
Eelco Dolstra
102d90ebf0 Fix duplicate setPathDisplay()
Fixes messages like 'copying /tmp/repo/tmp/repo to the store'. The
PosixSourceAccessor already sets the prefix. Setting the prefix twice
shouldn't be a problem, but GitRepoImpl::getAccessor() returns a
wrapped accessor so it's not actually idempotent.
2025-01-30 11:27:24 +01:00
Robert Hensing
fbe2940a08
Merge pull request #12363 from roberth/issue-12161
Issue #12161, add `meta.mainProgram`
2025-01-28 09:15:14 +01:00
Eelco Dolstra
8d744957a6
Merge pull request #12362 from roberth/refactor-realiseString
refactor: Extract EvalState::realiseString
2025-01-27 16:49:58 +01:00
Leandro Reina
6a3b4afc0a Merge remote-tracking branch 'upstream/master' into lfs 2025-01-27 14:44:41 +01:00
Eelco Dolstra
6a2198dfad
Merge pull request #12251 from nix-windows/local-store/fix-infinite-loop
local-store: fix infinite loop on Windows
2025-01-27 14:38:57 +01:00
Robert Hensing
850329dea5 packages.nix-cli: Add meta.mainProgram 2025-01-27 14:27:14 +01:00
Robert Hensing
7465fbe926 refactor: Extract EvalState::realiseString 2025-01-27 12:32:46 +01:00
Ben Millwood
4e5d1b281e Improve "illegal path references in fixed output derivation" error
The main improvement is that the new message gives an example of a path
that is referenced, which should make it easier to track down. While
there, I also clarified the wording, saying exactly why the paths in
question were illegal.
2025-01-25 20:10:43 +02:00
Robert Hensing
96e550efc5 Format .nix files
... with nixfmt (rfc style)
2025-01-24 17:04:02 +01:00
Eelco Dolstra
00d9e7e1f4 EvalState::resolveLookupPathPath(): Call resolveSymlinks() before pathExists()
Fixes #12339.
2025-01-24 12:15:07 +01:00
Robert Hensing
10c8d7988d
Merge pull request #12336 from NaN-git/fix-progress
libstore: Fix progress bars
2025-01-24 12:08:50 +01:00
Eelco Dolstra
7dfff58292 Rename InputPath -> InputAttrPath
Fixes #12098.
2025-01-23 16:34:35 +01:00
Eelco Dolstra
9060d0fe46 Fix missing format argument 2025-01-23 16:21:30 +01:00