1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
Commit graph

733 commits

Author SHA1 Message Date
Eelco Dolstra
54388893bc dep-built-drv-2.sh: Don't fail with "cannot create symlink" 2025-02-17 11:57:21 +01:00
John Ericson
222a57c9ca More interesting dynamic derivations example
Co-authored-by: Samuel Ainsworth <skainsworth@gmail.com>
2025-02-16 18:00:34 -05:00
Robert Hensing
07f853b295
Merge pull request #9415 from NixOS/fix-dynamic-derivations
Revert "Revert "Adapt scheduler to work with dynamic derivations
2025-02-16 23:59:39 +01:00
Robert Hensing
eb91014928
Merge pull request #12443 from DeterminateSystems/prefetch-out-link
nix flake prefetch: Add --out-link option
2025-02-12 22:22:04 +01:00
Eelco Dolstra
17d46041b8 Add test 2025-02-12 22:05:38 +01: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
Eelco Dolstra
b813a764e0 Merge remote-tracking branch 'origin/master' into self-input-attrs 2025-02-10 17:01:19 +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
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
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
Eelco Dolstra
38f391444b Add a test for a flake referencing a flake that has inputs.self 2025-02-04 22:14:38 +01: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
John Ericson
f90ba3a7c1
Update tests/functional/flakes/symlink-paths.sh 2025-02-04 11:25:14 -05:00
Eelco Dolstra
3c109095de Use 'nix flake prefetch' to get the store path of a flake
Future-proofing for when 'nix flake metadata' won't return a store
path anymore.
2025-02-04 15:24:50 +01:00
silvanshade
137ba71f02
Fix shellcheck lints 2025-02-03 17:47:37 -07: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
Steve Walker
453e8dc067 Fix flakes follow symlinks
Co-authored-by: Jan Christoph Bischko <jbischko@barracuda.com>
2025-02-02 08:30:04 +07:00
Eelco Dolstra
8006196c55 tests/functional/fetchGit.sh: Add a test for NAR hash mismatches 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
a142803c28 tests/functional/fetchGit.sh: Drop unnecessary --impure flags 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
Eelco Dolstra
177a067d66
Merge pull request #12372 from roberth/test-characterisation-log-to-stderr
tests/functional/characterisation/framework: Log to stderr
2025-01-30 11:34:39 +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
Eelco Dolstra
fa87ad6a7c Fix shellcheck warnings 2025-01-29 15:34:49 +01:00
Robert Hensing
a5de2dd274 tests/functional/characterisation/framework: Log to stderr
It seems that `meson test --print-errorlogs` only captures stderr,
so this makes it forward the logs as intended.

We might want to redirect stdout in our common setup script instead.
2025-01-28 09:26:33 +01:00
Robert Hensing
b04077c0ec fix: Update shifted source positions after formatting
Carefully reviewed...
2025-01-24 18:53:42 +01:00
Robert Hensing
96e550efc5 Format .nix files
... with nixfmt (rfc style)
2025-01-24 17:04:02 +01:00
Eelco Dolstra
d48d464c8b Add a test for #12339 2025-01-24 15:25:10 +01:00
Eelco Dolstra
00d9e7e1f4 EvalState::resolveLookupPathPath(): Call resolveSymlinks() before pathExists()
Fixes #12339.
2025-01-24 12:15:07 +01:00
Eelco Dolstra
261b213272
Merge pull request #11900 from DeterminateSystems/fix-help-test
Fix help test in dev shell
2025-01-23 15:20:34 +01:00
Eelco Dolstra
5b43163c6d Disable 'man' tests 2025-01-23 14:54:05 +01:00
Eelco Dolstra
2dae5acf86 Run the 'nix --help' tests early
These don't depend on 'man' so we don't need to skip them.
2025-01-23 14:28:48 +01:00
John Ericson
7f7ca3810b Fix #12295
We were simply passing in the wrong path. This went uncaught because the
TODO about deduplication hasn't happened yet.
2025-01-22 16:53:05 -05:00
Eelco Dolstra
e0c6ed1c83 Fix help test in dev shell
Not sure what the intent was expecting help.sh to fail in the main suite, but it caused `meson test` to fail inside a `nix develop` shell:

  $ meson test help --print-errorlogs
  ninja: Entering directory `/home/eelco/Dev/nix-master/build'
  1/1 nix-functional-tests:main / help        UNEXPECTEDPASS   4.02s
2025-01-22 21:07:50 +01:00
Eelco Dolstra
41983dba8f GitRepo::fetch(): Ignore $GIT_DIR
Fixes #12325.
2025-01-22 17:54:19 +01:00
Eelco Dolstra
17b6557c03
Merge pull request #12275 from andrewhamon/ah/set-priority-nix-env-install
nix-env: add a --priority flag to --install
2025-01-16 22:04:35 +01:00
Andy Hamon
3716ded8df nix-env: add a --priority flag to --install
nix-env can read priorities from a derivations meta attributes, but this
only works when installing a nix expression.

nix-env can also install bare store paths, however meta attributes are
not readable in that case. This means that a store path can not be
installed with a specific priority.

Some cases where it is advantageous to install a store path: a remote
host following a `nix copy`, or any time you want to save some
evaluation time and happen to already know the store path.

This PR addresses this shortcoming by adding a --priority flag to
nix-env --install.
2025-01-16 11:46:25 -08:00
Eelco Dolstra
521667eb89 Fix follow-paths test
Since ff8e2fe84e, 'path:' URLs on the
CLI are interpreted as relative to the current directory of the user,
not the path of the flake we're overriding.
2025-01-16 11:19:20 +01:00
Eelco Dolstra
550fe889ee Merge remote-tracking branch 'origin/master' into relative-flakes 2025-01-16 11:05:10 +01:00
John Ericson
e02026adae
Merge pull request #12254 from DeterminateSystems/fix-relative-path-on-cli
Fix relative 'path:' flakerefs in the CLI
2025-01-15 15:19:56 -05:00
mergify[bot]
c45dfeeef3
Merge pull request #12220 from DeterminateSystems/allow-dirty-locks
Add setting 'allow-dirty-locks'
2025-01-15 20:18:28 +00:00
Eelco Dolstra
ff8e2fe84e Fix relative 'path:' flakerefs in the CLI
And handle relative 'git+file:' flakerefs while we're at it (these
crashed with an assertion failure).

Fixes #12248.
2025-01-14 17:30:13 +01:00
Eelco Dolstra
cd0127f957 Merge remote-tracking branch 'origin/master' into relative-flakes 2025-01-13 14:13:56 +01:00
Eelco Dolstra
e161393299 Add setting 'allow-dirty-locks'
This allows writing lock files with dirty inputs, so long as they have
a NAR hash. (Currently they always have a NAR hash, but with lazy
trees that may not always be the case.)

Generally dirty locks are bad for reproducibility (we can detect if
the dirty input has changed, but we have no way to fetch it except
substitution). Hence we don't allow them by default.

Fixes #11181.
2025-01-10 17:55:30 +01:00
Robert Hensing
d9a50c0af2
Clarify cd call in tests/functional/flakes/flakes.sh 2025-01-10 09:57:54 +01:00
Bryan Lai
37ac18d1d9 tests/flake-in-submodule: git+file:./* input 2025-01-10 11:44:55 +08:00
Bryan Lai
9d088fa502 tests/flakes: check git+file:./${submodule} protocol
Relative, local git repo used to work (for submodules), but it
fails after 3e0129ce3b.

This commit adds a test to prevent such failure in the future.
2025-01-10 11:37:29 +08:00