1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 03:56:01 +01:00
Commit graph

20720 commits

Author SHA1 Message Date
Jörg Thalheim
723656daab
Merge pull request #13775 from xokdvium/more-pch
treewide: Futher improve compile times for clangStdenv builds
2025-08-17 14:47:41 +02:00
Jörg Thalheim
1cf0fe3186
Merge pull request #13773 from xokdvium/quotes-fragment
libutil: Fix handling of unescaped spaces, quotes and shevrons in queries and fragments
2025-08-17 14:45:42 +02:00
Sergei Zimmerman
bb9148fd5d
Merge pull request #13777 from PedroManse/master 2025-08-17 12:20:25 +03:00
Manse
ccc0a31f39
fix doc code example
Fixed nix shell's doc's shebang python example
2025-08-17 00:39:41 -03:00
Sergei Zimmerman
8be1cc6e96
libstore-tests: Improve compile times with PCH
(Before)

**** Time summary:
Compilation (25 times):
  Parsing (frontend):          145.5 s
  Codegen & opts (backend):     65.9 s

(After)

**** Time summary:
Compilation (26 times):
  Parsing (frontend):           39.9 s
  Codegen & opts (backend):     55.1 s
2025-08-17 01:08:31 +03:00
Sergei Zimmerman
347ed8d9ba
libfetchers: Improve compile times with PCH
(Before)

**** Time summary:
Compilation (17 times):
  Parsing (frontend):           72.3 s
  Codegen & opts (backend):     47.8 s

(After)

Compilation (19 times):
  Parsing (frontend):           27.5 s
  Codegen & opts (backend):     43.8 s
2025-08-17 00:57:14 +03:00
Sergei Zimmerman
f13aeaf2f1
libutil-tests: Improve compile times with PCH
(Before)

**** Time summary:
Compilation (30 times):
  Parsing (frontend):           98.2 s
  Codegen & opts (backend):     27.7 s

(After)

**** Time summary:
Compilation (31 times):
  Parsing (frontend):           34.9 s
  Codegen & opts (backend):     28.1 s
2025-08-17 00:57:06 +03:00
Sergei Zimmerman
d6973e105c
libexpr-tests: Improve compile times with PCH
(Before)

**** Time summary:
Compilation (14 times):
  Parsing (frontend):           60.1 s
  Codegen & opts (backend):     18.0 s

(After)

**** Time summary:
Compilation (15 times):
  Parsing (frontend):           16.6 s
  Codegen & opts (backend):     17.4 s
2025-08-17 00:56:54 +03:00
Sergei Zimmerman
3c0a5e0a51
nix-cli: Improve compile times
(Before)

**** Time summary:
Compilation (61 times):
  Parsing (frontend):          143.2 s
  Codegen & opts (backend):    105.8 s

(After)

**** Time summary:
Compilation (61 times):
  Parsing (frontend):          113.8 s
  Codegen & opts (backend):    111.7 s
2025-08-17 00:56:41 +03:00
Sergei Zimmerman
695f3bc7e3
tests/nixos: Fix daemon store reference in authorization test
Recent store reference cleanups have started canonicalizing
daemon -> unix://.
2025-08-16 23:31:57 +03:00
Sergei Zimmerman
dc1b2012af
libutil: Fix handling of unescaped spaces, quotes and shevrons in queries and fragments
Turns out we didn't have tests for some of the important behavior introduced
for flake reference fragments and url queries [1]. This is rather important
and is relied upon by existing tooling. This fixes up these exact cases before
handing off the URL to the Boost.URL parser.

To the best of my knowledge this implements the same behavior as prior regex-based
parser did [2]:

> fragmentRegex = "(?:" + pcharRegex + "|[/? \"^])*";
> queryRegex = "(?:" + pcharRegex + "|[/? \"])*";

[1]: 9c0a09f09f
[2]: https://github.com/NixOS/nix/blob/2.30.2/src/libutil/include/nix/util/url-parts.hh
2025-08-16 23:00:31 +03:00
John Ericson
0fd9ef0cf3
Merge pull request #13770 from obsidiansystems/delete-wrong-decl
Delete dangling declaration
2025-08-16 11:50:20 -04:00
John Ericson
d5102ab30c
Merge pull request #13771 from xokdvium/gdb-dev-shell
dev-shell: Add gdb
2025-08-16 11:45:24 -04:00
Sergei Zimmerman
0348030ae2
dev-shell: Add gdb
It's about time we added debuggers to the dev-shell. Having it in build inputs
does some magic so pretty printers for standard library types work better.
2025-08-16 18:27:39 +03:00
John Ericson
048cfb9cd6 Delete dangling declaration
There is no definition associated with this.
2025-08-16 11:27:10 -04:00
Jörg Thalheim
9fb62805b0
Merge pull request #13749 from Mic92/merge-queues
prepare merge queues for nix
2025-08-16 09:47:57 +02:00
John Ericson
3b03872ebf
Merge pull request #13766 from obsidiansystems/more-store-dir
Make a few more things use `StoreDirConfig` instead of `Store`
2025-08-15 16:20:39 -04:00
John Ericson
97c966cc69
Merge pull request #13765 from obsidiansystems/simplify-derivation-building-goal
Simplify `DerivationBuildingGoal`
2025-08-15 16:19:44 -04:00
John Ericson
9ccbe23056 DerivationBuilder Change missing initialOutput if..throw to assert
Since this goal has no (goal-wide) notion of "wanted outputs" (we're
building the derivation, and thus making all outputs), we should have
`initialOutputs` for all outputs, and if we're missing one that's an
internal error caused by a bug in Nix.

Concretely, `DerivationBuildingGoal::gaveUpOnSubstitution` now clearly
does create `initialOutputs` for all outputs, whereas a few commits ago
that was not obvious, so I feel confident in saying that this invariant
that should be upheld, in fact is upheld.

`scatchOutputs` is initialized for every initial output, so the same
change to it follows for the same reasons.
2025-08-15 15:50:46 -04:00
John Ericson
870bb68d38 DerivationBuilder::registerOutputs: Inline checkSuffix
It is a simple constant that is only used once.
2025-08-15 15:50:41 -04:00
John Ericson
4bc9ae67c7 Give DerivationBuilder a LocalStore not Store
This is just more honest, since we downcasted it to `LocalStore` in many
places. We had the downcast before because it wasn't needed in the hook
case, just the local building case, but now that `DerivationBuilder` is
separated and just does the building case, we have formalized the
boundary where the single downcast should occur.
2025-08-15 15:50:36 -04:00
John Ericson
14e355d87d Remove InitialOutput::wanted
No derivation goal type has a notion of variable wanted outputs any
more. They either want them all, or they just care about a single
output, in which case we would just store this information for the one
output in question.
2025-08-15 15:50:35 -04:00
John Ericson
79fb9b0d3c Make a few more things use StoreDirConfig instead of Store 2025-08-15 15:35:51 -04:00
John Ericson
316fef35dc
Merge pull request #13764 from obsidiansystems/simplify-store-dir
Simplify "Store dir" superclass
2025-08-15 15:24:47 -04:00
Sergei Zimmerman
1ed3ae8a9d
Merge pull request #13763 from obsidiansystems/more-flexible-get
More flexible typing for `get` in `util.hh`
2025-08-15 22:09:57 +03:00
John Ericson
0ef818dd92 More flexible typing for get in util.hh
This is good for e.g. `std::string_view` and `StringMap`.

Needed by #11139

Co-authored-by: Sergei Zimmerman <145775305+xokdvium@users.noreply.github.com>
2025-08-15 14:23:37 -04:00
John Ericson
64c2ee3f45 Simplify "Store dir" superclass
We can cut out some gratuitous inhertence as follows:

- `MixStoreDirMethods` -> `StoreDirConfig`

- `StoreDirConfig` deleted because no longer needed. It is just folded
  into `StoreConfig`.

- `StoreDirConfigBase` -> `StoreConfigBase` same trick still needed, but
  now is for `StoreConfig` not `StoreDirConfig`

Here's how we got here:

1. I once factored out `StoreDirConfig` in #6236.

2. I factored out `MixStoreDirMethods` in #13154.

But, I didn't realize at point (2) that we didn't need `StoreDirConfig`
anymore, all uses of `StoreDirConfig` could instead be uses of
`MixStoreDirMethods`. Now I am doing that, and renaming
`MixStoreDirMethods` to just `StoreDirConfig` to reduce churn.
2025-08-15 14:12:37 -04:00
Sergei Zimmerman
22378ea093
Merge pull request #13762 from xokdvium/delete-footguns
libutil: Delete footgun overloads of get and getOr
2025-08-15 17:58:32 +03:00
Sergei Zimmerman
408c09a120
libutil: Delete footgun overloads of get and getOr
To avoid mistakes like the one in cea85e79ee.
These overloads are just asking for trouble.
2025-08-15 17:29:17 +03:00
Sergei Zimmerman
c736db5320
Merge pull request #13761 from xokdvium/fix-dangling-pointers
libstore: Fix dangling pointers in DerivationGoal constructors
2025-08-15 17:03:49 +03:00
Sergei Zimmerman
cea85e79ee
libstore: Fix dangling pointers in DerivationGoal constructors
This leads to a use-after free, because staticOutputHashes returns a temporary
object that dies before we can do a `return *mOutputHash`.

This is most likely the cause for random failures in Hydra [1].

[1]: https://hydra.nixos.org/build/305091330/nixlog/2
2025-08-15 16:39:28 +03:00
Jörg Thalheim
4e776a5be8
Merge pull request #13753 from obsidiansystems/simplify-derivation-goal
Simplify `DerivationGoal` in many ways
2025-08-15 08:25:47 +02:00
Jörg Thalheim
677b1c0f8f prepare merge queues for nix 2025-08-15 08:05:01 +02:00
Sergei Zimmerman
f64000e3f4
Merge pull request #13756 from xokdvium/fix-copy-path-message
libstore: Fix makeCopyPathMessage
2025-08-15 02:10:41 +03:00
Sergei Zimmerman
e74ef417db
libstore: Fix makeCopyPathMessage
Old code completely ignored query parameters and it seems ok to keep
that behavior. There's a lot of code out there that parses nix code
like nix-output-monitor and it can't parse messages like:

> copying path '/nix/store/wha2hi4yhkjmccqhivxavbfspsg1wrsj-source' from 'https://cache.nixos.org' to 'local://'...

Let's not break these tools without a good reason. This goes in line
with what other code does by ignoring parameters in logs.

The issue is just in detecting the shorthand notations for the store
reference - not in printing the url in logs.

By default the daemon opens a local store with ?path-info-cache-size=0,
so that leads to the erronenous 'local://'.
2025-08-15 00:55:03 +03:00
John Ericson
4b4895e750
Merge pull request #13755 from xokdvium/concise-uri-logs
treewide: Remove getUri and replace with getHumanReadableURI where appropriate
2025-08-14 15:39:09 -04:00
Sergei Zimmerman
1b7ffa53af
treewide: Remove getUri and replace with getHumanReadableURI where appropriate
The problem with old code was that it used getUri for both the `diskCache`
as well as logging. This is really bad because it mixes the textual human
readable representation with the caching.

Also using getUri for the cache key is really problematic for the S3 store,
since it doesn't include the `endpoint` in the cache key, so it's totally broken.

This starts separating the logging / cache concerns by introducing a
`getHumanReadableURI` that should only be used for logging. The caching
logic now instead uses `getReference().render(/*withParams=*/false)` exclusively.
This would need to be fixed in follow-ups, because that's really fragile and
broken for some store types (but it was already broken before).
2025-08-14 16:47:05 +03:00
Jörg Thalheim
58eabe7479
Merge pull request #13754 from xokdvium/cleanup-docker-check-secrets
ci: Cleanup docker check secrets
2025-08-14 15:27:46 +02:00
Sergei Zimmerman
e6f3a193d8
libstore: Fix makeCopyPathMessage after config getUri refactor 2025-08-14 15:52:24 +03:00
Sergei Zimmerman
26dbda6302
ci/docker_push_image: Remove dead step
This step is now part of the check_secrets job and
the output is completely unused.
2025-08-14 14:54:45 +03:00
Sergei Zimmerman
48d15ed1fb
ci/check_secrets: Remove deprecated set-output 2025-08-14 14:54:20 +03:00
John Ericson
4a2de1dbab DerivationGoal Make some fields immutable
We can set both during construction, yay!
2025-08-14 00:39:00 -04:00
John Ericson
f155dffe59 DerivationGoal::done Clean up parameter types
We don't need to ask all these callers to build these single-entry maps
for us.
2025-08-14 00:35:52 -04:00
John Ericson
c940283750 DerivationBuilder
Move output result filtering logic and assert just into the branch where
it is not obviously a no op / meeting the assertion.

Add a comment too, while we are at it.
2025-08-14 00:35:34 -04:00
John Ericson
14441f9382 DerivationGoal inline gaveUpOnSubstitution lambda
We can shuffle around control flow so it's only called once. You'll
definitely want to review this diff ignoring whitespace.
2025-08-14 00:35:24 -04:00
John Ericson
88275e5723 DerivationGoal slight cleanup of some impure drv logic 2025-08-14 00:16:26 -04:00
John Ericson
7707d0acad Get rid of filterDrvOutputs
We don't need it any more, because we only used it in the
single-wanted-output `DerivationGoal`.
2025-08-14 00:09:08 -04:00
John Ericson
766a52ce87 DerivationOutput: Remove outputKnown state
Now that `DerivationGoal::checkPathValidity` is legible, we can see that
it only sets `outputKnown`, and doesn't read it. Likewise, with
co-routines, we don't have tiny scopes that make local variables
difficult. Between these two things, we can simply have
`checkPathValidity` return what it finds, rather than mutate some state,
and update everyting to use local variables.

The same transformation could probably be done to the other derivation
goal types (which currently, unfortunately, contain their own
`checkPathValidity`s, though they are diverging, and we hope and believe
that they continue to diverge).
2025-08-13 23:59:06 -04:00
John Ericson
2324fe3515 DerivationBuilder::checkPathValidity: Big simplify
`Store::queryPartialDerivationOutputMap` is nothing but checking
statically-known output paths, and then `Store::queryRealisation`, and
we were doing both of those things already. Inline that and simplify,
again taking advantage of the fact that we only care about one output.
2025-08-13 23:23:11 -04:00
John Ericson
b6ca60cb82 DerivationBuilder::checkPathValidity: Simplify allValid calc
Now that the loops is gone, we can just inline this mutation to a single
simple expression.
2025-08-13 23:01:58 -04:00