1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-26 20:01:15 +02:00
Commit graph

12190 commits

Author SHA1 Message Date
Jörg Thalheim
b3bbbd2e71 fix armv7/i686 build 2025-04-17 13:56:11 +02:00
John Ericson
9792d6bbd9 Move DerivationBuilder to its own file/header
The building logic is now free of the scheduling logic!

(The interface between them is just what is in the new header. This
makes it much easier to audit, and shrink over time.)
2025-04-16 18:59:17 -04:00
John Ericson
6c2a7fdc49 Copy local-derivation-goal.cc to derivation-builder.{cc,hh}
This is done to prior to splitting, just like
05cc5a8587 for
68f4c728ec.
2025-04-16 18:59:17 -04:00
John Ericson
d98c0dbe99 Start separating scheduling from building
We have a new `DerivationBuilder` struct, and `DerivationBuilderParams`
`DerivationBuilderCallbacks` supporting it.

`LocalDerivationGoal` doesn't subclass any of these, so we are ready to
now move them out to a new file!
2025-04-16 17:54:56 -04:00
John Ericson
f81c06accf Gut LocalDerivationGoal::tryLocalBuild
Now, most of it is in two new functions:
`LocalDerivationGoal::{,un}repareBuild`.

This might seems like a step backwards from coroutines --- now we have
more functions, and are stuck with class vars --- but I don't think it
needs to be.

There's a few options here:

- (Re)introduce coroutines for the isolated building logic. We could use the
  same coroutines types, or simpler ones specialized to this use-case.
  The `tryLocalBuild` caller can still use `Goal::Co`, and just will
  manually "pump" this inner coroutine.

- Return closures from each step. This is sort of like coroutines by
  hand, but it still allows us to stop writing down the local variables
  in each type.

  Being able to fully-use RAII again would be very nice!

- Keep top-level first-order functions like now, but make more
  functional. Instead of having one state object (`DerivationBuilder`)
  for all steps (setup, run, teardown), we can have separate structs for
  the live variables at each point we consume and return.

  This at least avoids "are these variables active at this time?"
  questions, but doesn't give us the full benefit of RAII as we must
  manually ensure FIFO create/destroy orders still.

One thing to note is that by keeping the `outputLock` unlocking in
`tryLocalBuild`, we are arguably uncovering a rebuild scheduling vs
building distinction, as the output locks are pretty squarely a
scheduling concern. It's nice that the builder doesn't need to know
about them at all.
2025-04-16 17:39:45 -04:00
John Ericson
ae7f411a18 Remove some unused includes
This is unreleated to the other commits in this PR.
2025-04-16 17:39:22 -04:00
John Ericson
e83ef7a477 Make appendLogTailErrorMsg as class method after all
The other parameters it took were somewhat implementation-specific.
2025-04-16 15:40:59 -04:00
Jörg Thalheim
89ba6dff66
Merge pull request #13032 from obsidiansystems/more-outputs-test
Improve derivation "advanced attrs" test, fix almost-bug
2025-04-15 19:08:35 +02:00
Jörg Thalheim
009ff8e5a7
Merge pull request #13013 from NaN-git/fix-ceil-floor
libexpr: fix UB in builtins.ceil and builtins.floor
2025-04-15 18:56:46 +02:00
Jörg Thalheim
cf6da9234c
Merge pull request #12410 from obsidiansystems/derivation-options-2
Scrap `ParsedDerivation` for parts
2025-04-15 18:36:11 +02:00
John Ericson
32409dd7d7 Remove stray assignment side affect in lambda
This was almost a bug! It wasn't simply because another assignment would
clobber it later.
2025-04-15 12:29:17 -04:00
John Ericson
a0b2b75f59 Derivation "advanced attrs" test: Ensure fields are set to distinct values
We had fields set to the same values before in our test data. This is
not a problem per-se, but does mean we wouldn't catch certain mixups.
Now, the fields are set to distinct values (where possible), which makes
the test more robust.
2025-04-15 12:29:14 -04:00
Jörg Thalheim
99a16c5203
Merge pull request #13026 from roberth/issue-13018
Fix issue #13018, `sourceInfo` strict in `outputs`
2025-04-15 13:51:02 +02:00
Jörg Thalheim
22c928f9c0
Merge pull request #12992 from DeterminateSystems/input-cache
Rename FlakeCache to InputCache and move it to libfetchers
2025-04-15 13:32:39 +02:00
Robert Hensing
2109a5a206 fix: Evaluate flake parent source without evaluating its outputs
This requires that we refer to the `sourceInfo` instead of the
`result`. However, `sourceInfo` does not create a chain of basedir
resolution, so we add that back with `flakeDir`.
2025-04-15 13:22:53 +02:00
Robert Hensing
9de9410f29 call-flake.nix: allNodes.${key} -> allNodes.${key}.result 2025-04-15 13:22:53 +02:00
Robert Hensing
674375b021 call-flake.nix: refactor: Bring mapAttrs into scope 2025-04-15 13:22:53 +02:00
John Ericson
d8be4f618f Scrap ParsedDerivation for parts
Only a much smaller `StructuredAttrs` remains, the rest is is now moved
to `DerivationOptions`.

This gets us quite close to `std::optional<StructuredAttrs>` and
`DerivationOptions` being included in `Derivation` as fields.
2025-04-14 16:14:41 -04:00
John Ericson
1e31b60043 Limit ParsedDerivation just to the derivation's environment
This moves us towards getting rid of `ParsedDerivation` and just having
`DerivationOptions`.

Co-Authored-By: HaeNoe <git@haenoe.party>
2025-04-14 15:46:55 -04:00
John Ericson
d285b80033 Move exportReferencesGraph to DerivationOptions
Tests are updated accordingly.
2025-04-14 14:24:36 -04:00
John Ericson
307dbe9914 Test derivation options with content-addressing too
Now, both the unit and functional tests relating to derivation options
are tested both ways -- with input addressing and content-addressing
derivations.
2025-04-14 13:43:46 -04:00
Eelco Dolstra
4966217b6a Move the InputCache to EvalState 2025-04-14 14:29:14 +02:00
mergify[bot]
b1fe93fab7
Merge pull request #13015 from obsidiansystems/derivation-options
`ParsedDerivation`: don't take `drvPath`
2025-04-14 11:14:34 +00:00
Jörg Thalheim
3f3fd2c94b
Merge pull request #12976 from picnoir/pic/multisign
store URI: introduce multiple signatures support
2025-04-14 11:20:41 +02:00
Picnoir
7ea536fe84 Narinfo sign: multiple signatures variant
This is a small optimization used when we're signing a narinfo for
multiple keys in one go. Using this sign variant, we only compute the
NAR fingerprint once, then sign it with all the keys.
2025-04-14 10:30:47 +02:00
John Ericson
0123640009 ParsedDerivation: don't take drvPath
It is just use for adding context to errors, but we have `addTrace` to
do that. Let the callers do that instead.

The callers doing so is a bit duplicated, yes, but this will get better
once `DerivationOptions` is included in `Derivation`.
2025-04-13 18:21:13 -04:00
Philipp Otterbein
56d37656ac libexpr: fix UB in builtins.ceil and builtins.floor
tighten and fix specification of both builtins
2025-04-13 04:36:09 +02:00
Jörg Thalheim
71567373b6
Merge pull request #13008 from Mic92/aliases
Move alias support from NixArgs to MultiCommand + test
2025-04-12 11:06:09 +02:00
Dean De Leo
51073607ea S3: opt-in the STSProfileCredentialsProvider
The STSProfileCredentialsProviders allows to assume a specific IAM role
when accessing an S3 repository. Sometimes this is needed to obtain the
permissions to operate on the bucket.
2025-04-11 23:47:56 +02:00
Philipp Otterbein
49f757c24a add isInterrupted() call and replace some checkInterrupt() occurrences 2025-04-11 22:48:10 +02:00
Philipp Otterbein
db297d3dda libstore: same progress bar behavior for PUT and POST requests
- no differentiation between uploads and downloads in CLI
2025-04-11 22:48:10 +02:00
Philipp Otterbein
9da01e69f9 libstore S3: fix progress bar and make file transfers interruptible 2025-04-11 22:48:10 +02:00
Eelco Dolstra
6cd2b4e169 Move alias support from NixArgs to MultiCommand
This allows subcommands to declare aliases, e.g. `nix store ping` is
now a proper alias of `nix store info`.
2025-04-10 19:48:55 +02:00
Eelco Dolstra
e3042f10af Move getAccessorCached() to InputCache 2025-04-10 10:24:15 +02:00
Eelco Dolstra
012453d1e6 Move the input cache into libfetchers 2025-04-10 10:24:15 +02:00
Eelco Dolstra
c7f8147282 Rename FlakeCache -> InputCache and key it on Inputs instead of FlakeRefs 2025-04-10 10:24:15 +02:00
Eelco Dolstra
3f3cc6f438
Merge pull request #12991 from Mic92/cgroup
linux/cgroup: delete double quote in error message
2025-04-10 10:11:24 +02:00
Jörg Thalheim
b3f80283a6 linux/cgroup: delete double quote in error message 2025-04-10 09:31:48 +02:00
Eelco Dolstra
9d3595646d nix shell: Resolve symlinks in storeFS
`storeFS` is the `MountedSourceAccessor` that wraps `store->getFSAccessor()`.
2025-04-09 17:34:19 -04:00
John Ericson
eb643d034f Store::getFSAccessor: Do not include the store dir
Rather than "mounting" the store inside an empty virtual filesystem,
just return the store as a virtual filesystem. This is more modular.

(FWIW, it also supports two long term hopes of mind:

1. More capability-based Nix language mode. I dream of a "super pure
   eval" where you can only use relative path literals (See #8738), and
   any `fetchTree`-fetched stuff + the store are all disjoint (none is
   mounted in another) file systems.

2. Windows, where the store dir may include drive letters, etc., and is
   thus unsuitable to be the prefix of any `CanonPath`s.

)

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-04-09 17:34:18 -04:00
John Ericson
b74b0f4e1c Fix another machine config parsing bug
We were ignorning the result of `trim`, and after my last change we were
also trimmming too early.
2025-04-09 15:33:09 -04:00
Jörg Thalheim
d45067177e
Merge pull request #12984 from obsidiansystems/fix-machine-commment-semicolon
Fix `;` and `#` bug in machine file parsing
2025-04-09 20:26:03 +02:00
John Ericson
f8b13cce19 Fix ; and # bug in machine file parsing
Comments go to the end of the line, not merely the next ; *or* \n. Fix
by splitting on `;` *within* lines, and test.
2025-04-09 12:38:42 -04:00
Eelco Dolstra
77d4316353 Actually ignore system/user registries during locking
Something went wrong in #12068 so this didn't work. Also added a test.
2025-04-09 17:59:51 +02:00
Picnoir
e12369a68e store URI: introduce multiple signatures support
Add a `secretKeyFiles` URI parameter in the store URIs receiving a
coma-separated list of Nix signing keyfiles.

For instance:

  nix copy --to "file:///tmp/store?secret-keys=/tmp/key1,/tmp/key2" \
    "$(nix build --print-out-paths nixpkgs#hello)"

The keys passed through this new store URI parameter are merged with
the key specified in the `secretKeyFile` parameter, if any.

We'd like to rotate the signing key for cache.nixos.org. To simplify
the transition, we'd like to sign the new paths with two keys: the new
one and the current one. With this, the cache can support nix
configurations only trusting the new key and legacy configurations
only trusting the current key.

See https://github.com/NixOS/rfcs/pull/149 for more informations
behind the motivation.
2025-04-09 13:30:37 +02:00
Robert Hensing
e76bbe413e
Merge pull request #12877 from roberth/c-api-libflake-override-input
C API: Flake loading, input overriding
2025-04-08 09:01:51 +02:00
Graham Christensen
9b47b2b217 format as required 2025-04-07 17:24:41 -04:00
Graham Christensen
06acbd37bd Add trailing commas on addFlag incantations 2025-04-07 17:18:15 -04:00
John Ericson
596389a5f6
Merge pull request #12958 from DeterminateSystems/unlinked-tests
Fix some unlinked tests
2025-04-07 16:41:07 -04:00
John Ericson
6789202af0
Merge pull request #12962 from DeterminateSystems/clang-tidy-warnings
Fix some clang-tidy warnings
2025-04-07 16:37:02 -04:00