1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 19:03:16 +02:00
Commit graph

20080 commits

Author SHA1 Message Date
Eelco Dolstra
5c552b62fc lockFlake(): When refetching a locked flake, use the locked ref
Otherwise we may accidentally update a lock when we shouldn't.

Fixes #12445.
2025-02-12 14:53:04 +01:00
Eelco Dolstra
49f226e87b
Merge pull request #12457 from NixOS/mergify/bp/2.26-maintenance/pr-12450
packaging/components.nix: Don't import a symlink (backport #12450)
2025-02-12 12:56:51 +01:00
Eelco Dolstra
ca7e686f4d
Merge pull request #12439 from MaxHearnden/cloexec
Set FD_CLOEXEC on sockets created by curl
2025-02-12 12:49:55 +01:00
Eelco Dolstra
d308228497 Don't import a symlink
This is a workaround to avoid differing evaluation results between Nix
2.19 and >= 2.20 (#12449).

(cherry picked from commit 2e20a5f822)
2025-02-12 11:42:49 +00:00
Eelco Dolstra
fda585f35c
Merge pull request #12450 from DeterminateSystems/no-symlink
packaging/components.nix: Don't import a symlink
2025-02-12 12:40:45 +01:00
John Ericson
50912d02e2 Get rid of impureOutputHash
I do not believe there is any problem with computing
`hashDerivationModulo` the normal way with impure derivations.

Conversely, the way this used to work is very suspicious because two
almost-equal derivations that only differ in depending on different
impure derivations could have the same drv hash modulo. That is very
suspicious because there is no reason to think those two different
impure derivations will end up producing the same content-addressed
data!

Co-authored-by: Alain Zscheile <zseri.devel@ytrizja.de>
2025-02-12 01:35:07 -05:00
Jörg Thalheim
23259bde1a
Merge pull request #12255 from NaN-git/fix-7359
SinkToSource: avoid heap allocation
2025-02-12 13:00:36 +07:00
Eelco Dolstra
dfbd030d3f
Merge pull request #12453 from NixOS/mergify/bp/2.26-maintenance/pr-12448
copyPathToStore(): Preserve symlinks (backport #12448)
2025-02-11 23:16:31 +01:00
Eelco Dolstra
83306bb841 copyPathToStore(): Preserve symlinks
E.g. in a derivation attribute `foo = ./bar`, if ./bar is a symlink,
we should copy the symlink to the store, not its target. This restores
the behaviour of Nix <= 2.19.

(cherry picked from commit 26b87e78b5)
2025-02-11 21:51:39 +00:00
Eelco Dolstra
2e20a5f822 Don't import a symlink
This is a workaround to avoid differing evaluation results between Nix
2.19 and >= 2.20 (#12449).
2025-02-11 22:42:36 +01:00
John Ericson
c000c16509
Merge pull request #12448 from DeterminateSystems/dont-follow-symlink-attrs
copyPathToStore(): Preserve symlinks
2025-02-11 15:55:50 -05:00
Eelco Dolstra
26b87e78b5 copyPathToStore(): Preserve symlinks
E.g. in a derivation attribute `foo = ./bar`, if ./bar is a symlink,
we should copy the symlink to the store, not its target. This restores
the behaviour of Nix <= 2.19.
2025-02-11 20:58:48 +01:00
Sandro Jäckel
dcbf4dcc09
Only try to chmod /nix/var/nix/profiles/per-user when necessary
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-02-11 18:21:50 +01:00
Eelco Dolstra
254b7afe66 nix flake prefetch: Add --out-link option
This makes `nix flake prefetch` more useful for scripting and prevents
the result from being GC'ed prematurely.
2025-02-10 17:52:26 +01:00
Aiden Fox Ivey
55c1e4454e
Update src/libstore/unix/build/local-derivation-goal.cc
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-02-10 11:37:37 -05:00
Eelco Dolstra
92bf150b1c
Merge pull request #12421 from DeterminateSystems/self-input-attrs
Add `inputs.self.submodules` flake attribute
2025-02-10 17:35:46 +01:00
Eelco Dolstra
2819d8b66a Add release note 2025-02-10 17:19:34 +01:00
Eelco Dolstra
528b286cf7 Remove stray line 2025-02-10 17:14:55 +01:00
Eelco Dolstra
4b75edacd7 Restore NAR hash assertion 2025-02-10 17:13:17 +01:00
Eelco Dolstra
b813a764e0 Merge remote-tracking branch 'origin/master' into self-input-attrs 2025-02-10 17:01:19 +01:00
John Ericson
1f485b6c5e
Merge pull request #12430 from DeterminateSystems/relative-path-literals
Parser: Respect the accessor of the source file for relative paths
2025-02-10 10:28:44 -05:00
Eelco Dolstra
428a3e8cc8 Add TODO 2025-02-10 16:18:57 +01:00
mergify[bot]
4c3786dd40
Merge pull request #12436 from NixOS/mergify/bp/2.26-maintenance/pr-12373
pre-commit/check-merge-conflicts-2: fix use outside dev shell (backport #12373)
2025-02-10 15:15:29 +00:00
Eelco Dolstra
d4ecf15dad smudgeLfs: Use default value
Eventually this should probably become a struct of options.
2025-02-10 16:11:53 +01:00
Eelco Dolstra
c02fcebb30 Add release note 2025-02-10 16:08:03 +01:00
Robert Hensing
0531f1299c Resolve conflict 2025-02-10 16:01:13 +01:00
Eelco Dolstra
d78daaa416 getLfsEndpointUrl(): Use our RAII helpers 2025-02-10 15:59:32 +01:00
Eelco Dolstra
c210efa9ae Move git-lfs-fetch into its own source file 2025-02-10 15:55:25 +01:00
Eelco Dolstra
9db070d7a2 Misc code cleanups 2025-02-10 15:46:46 +01:00
Eelco Dolstra
c10dbdccac libfetchers: Drop no longer needed curl dependency 2025-02-10 15:19:28 +01:00
Eelco Dolstra
40e8c5f613 Fix possible deref of null git_config 2025-02-10 15:16:54 +01:00
Robert Hensing
df8d5e61ad test: Fix shellcheck by giving git-hashing scripts shebangs
This seems to be the way to do it now, even though I can't run them
without setting at least one env var.
I'll only fix shellcheck for now. Don't shoot the messenger.

It isn't quite clear to me why the previous commit masked this problem,
but I'm glad shellcheck has an effect or more effect now.
2025-02-10 15:14:53 +01:00
Robert Hensing
30435e0559 pre-commit/check-merge-conflicts-2: fix use outside dev shell
Note that this is just a script that is meant to run outside a
derivation (but also can be called by a derivation builder).
`touch $out` does not belong in it.

`touch $out` worked accidentally in the derivation-based check,
and also in the dev shell, but if pre-commit is invoked without
the dev shell it would fail.
2025-02-10 15:14:44 +01:00
Eelco Dolstra
1cb9a354fb Merge remote-tracking branch 'origin/master' into lfs 2025-02-10 14:46:01 +01:00
John Ericson
967d7b9846
Merge pull request #12441 from obsidiansystems/content-addressing-derivation
Rename to "content-address*ing* derivation"
2025-02-10 03:01:12 -05: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
mergify[bot]
aa383a0b85
Merge pull request #12373 from roberth/fix-pre-commit
pre-commit/check-merge-conflicts-2: fix use outside dev shell
2025-02-07 11:07:12 +00:00
Robert Hensing
414c346560 test: Use skipTest instead of exit 0
This way shellcheck is ok with it, and it conveys that a significant
chunk of the test is skipped.
2025-02-07 11:20:18 +01:00
Robert Hensing
77a8386022 test: Fix shellcheck by giving git-hashing scripts shebangs
This seems to be the way to do it now, even though I can't run them
without setting at least one env var.
I'll only fix shellcheck for now. Don't shoot the messenger.

It isn't quite clear to me why the previous commit masked this problem,
but I'm glad shellcheck has an effect or more effect now.
2025-02-07 10:56:15 +01:00
Robert Hensing
73060b4972 pre-commit/check-merge-conflicts-2: fix use outside dev shell
Note that this is just a script that is meant to run outside a
derivation (but also can be called by a derivation builder).
`touch $out` does not belong in it.

`touch $out` worked accidentally in the derivation-based check,
and also in the dev shell, but if pre-commit is invoked without
the dev shell it would fail.
2025-02-07 10:56:15 +01: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
Eelco Dolstra
31bdb2a8ff
Merge pull request #12429 from NixOS/mergify/bp/2.26-maintenance/pr-12386
Git fetcher: Don't create refs when fetching by revision (backport #12386)
2025-02-06 15:24:14 +01:00
Eelco Dolstra
8e4cd2f537 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'

(cherry picked from commit c8b22643ba)
2025-02-06 14:05:03 +00:00
Eelco Dolstra
1fe33c13d9 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'

(cherry picked from commit ee9fa0d360)
2025-02-06 14:05:03 +00:00
Eelco Dolstra
727cf59997 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.

(cherry picked from commit 9f72d5bce9)
2025-02-06 14:05:02 +00:00
John Ericson
fc83c6ccb3
Merge pull request #12379 from silvanshade/blake3-c
Add BLAKE3 hashing algorithm
2025-02-05 22:43:44 -05:00
silvanshade
7fd2125573
Add BLAKE3 to documentation 2025-02-05 17:49:15 -07:00