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

798 commits

Author SHA1 Message Date
John Ericson
2898dbe2d9
Merge pull request #14073 from fzakaria/fzakaria/shellcheck-functional-dependencies.builder0
shellcheck fix functional/dependencies.builder0.sh
2025-09-25 02:10:14 -04:00
Jörg Thalheim
a534a27571
Merge branch 'master' into fzakaria/shellcheck-functional-dependencies.builder0 2025-09-25 07:37:30 +02:00
Jörg Thalheim
5d6af1243a
Merge branch 'master' into fzakaria/shellcheck-functional-dyn-drv-build-built-drv 2025-09-25 07:35:10 +02:00
Farid Zakaria
bc13130497
shellcheck fix tests/functional/dyn-drv/dep-built-drv.sh (#14078) 2025-09-25 03:28:16 +00:00
John Ericson
d2595130c6
Merge pull request #14074 from fzakaria/fzakaria/shellcheck-functional-dependencies
shellcheck fix functional/dependencies.sh
2025-09-24 22:57:09 -04:00
John Ericson
db25195bb2
Merge pull request #14077 from fzakaria/fzakaria/shellcheck-dyn-drv-common
shellcheck fix functional/dyn-drv/common.sh
2025-09-24 22:51:55 -04:00
John Ericson
5842aa2cac
Merge pull request #14070 from fzakaria/fzakaria/shellcheck-functional-config.sh
shellcheck fix functional/config.sh
2025-09-24 22:47:21 -04:00
Farid Zakaria
614ef6cfb1 shellcheck fix functional/dyn-drv/common.sh 2025-09-24 19:18:30 -07:00
Farid Zakaria
59791082fa shellcheck fix functional/dyn-drv/build-built-drv.sh 2025-09-24 19:17:12 -07:00
Farid Zakaria
c7c74fec67 shellcheck fix functional/dependencies.sh 2025-09-24 19:11:00 -07:00
Farid Zakaria
121a8ab3ec shellcheck fix functional/dependencies.builder0.sh 2025-09-24 19:09:21 -07:00
Farid Zakaria
832100f543 shellcheck fix functional/config.sh 2025-09-24 18:59:41 -07:00
Farid Zakaria
92f8f87dd1 shellcheck fix tests/functional/completions.sh 2025-09-24 18:56:00 -07:00
Sergei Zimmerman
97ce7759d0
libexpr: Use same naive iterative merging but with evalForUpdate 2025-09-24 21:47:59 +03:00
John Ericson
7ea31c6e56 Run multiple outputs and build-delete test for CA drvs also 2025-09-22 16:54:30 -04:00
Robert Hensing
4183308ee2 tests/func*/characterisation-test-infra: Fix shellcheck 2025-09-22 21:06:26 +02:00
Robert Hensing
926287d813 tests/func*/ca/common: Fix shellcheck 2025-09-22 21:06:26 +02:00
Robert Hensing
8c31e07cce tests/func*/ca/build-with-garbage-path: Fix shellcheck 2025-09-22 21:06:26 +02:00
Sergei Zimmerman
a453a49043
tests: Tests for writeable dummy in-memory store 2025-09-21 13:36:31 +03:00
Sergei Zimmerman
94d37e62fc
treewide: Support builds with ASAN, enable in CI
Enables builds with ASAN to catch memory corruption
bugs faster and in CI. This is an incredibly valuable
instrument that must be used as much as possible.

Somewhat based on jade's work from Lix, though there's a lot that
we have to do differently:

19ae87e5ce

Co-authored-by: Jade Lovelace <lix@jade.fyi>
2025-09-19 01:33:57 +03:00
John Ericson
9d7229a2a4 Make the JSON format for derivation use basename store paths
See #13570 for details --- the idea is that included the store dir in
store paths makes systematic JSON parting with e.g. Serde, Aeson,
nlohmann, or similiar harder.

After talking to Eelco, we are changing the `Derivation` format right
away because not only is `nix derivation` technically experimental, we think it is
also less widely used in practice than, say, `nix path-info`.

Progress on #13570
2025-09-17 16:38:17 -04:00
Seth Flynn
ecdda5798c nix flake check: Skip substitutable derivations
Since `nix flake check` doesn't produce a `result` symlink, it doesn't
actually need to build/substitute derivations that are already known
to have succeeded, i.e. that are substitutable.

This can speed up CI jobs in cases where the derivations have already
been built by other jobs. For instance, a command like

  nix flake check github:NixOS/hydra/aa62c7f7db31753f0cde690f8654dd1907fc0ce2

should no longer build anything because the outputs are already in
cache.nixos.org.

Based-on: https://github.com/DeterminateSystems/nix-src/pull/134
Based-on: https://gerrit.lix.systems/c/lix/+/3841
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-09-15 21:31:03 +02:00
Cole Helbling
ed6ef7cdf4 Test that using --inputs-from with a flakeref that has a dir works
Will not pass until the next commit.
2025-09-08 09:00:59 +02:00
Cole Helbling
258d41bfb6 Test that dir is propagated from registry entry 2025-09-07 19:40:23 +02:00
Eelco Dolstra
14c001d613 Add a test for nix flake check building checks 2025-09-07 14:41:40 +02:00
Eelco Dolstra
9ff427d7ba
Merge pull request #13911 from xokdvium/store-uri-daemon-local
libstore: Do not normalize daemon -> unix://, local -> local://
2025-09-07 14:10:45 +02:00
Sergei Zimmerman
3513ab13dc
libstore: Do not normalize daemon -> unix://, local -> local://
This is relied upon (specifically the `local` store) by existing
tooling [1] and we broke this in 3e7879e6df (which
was first released in 2.31).

To lessen the scope of the breakage we should not normalize "auto" references
and explicitly specified references like "local" or "daemon". It also makes
sense to canonicalize local://,daemon:// to be more compatible with prior
behavior.

[1]: 05e1b3cba2/lib/NOM/Builds.hs (L60-L64)
2025-09-05 04:14:36 +03:00
John Ericson
7b22cd5105
Merge pull request #13839 from Mic92/infra
don't include derivation name in temporary build directories
2025-09-03 17:15:03 -04:00
Jörg Thalheim
3e0fb3f8d2
Merge pull request #13881 from xokdvium/pass-url-verbatim
lib{store,fetchers}: Pass URLs specified directly verbatim to FileTra…
2025-09-01 20:06:50 +02:00
Sergei Zimmerman
e548700010
lib{store,fetchers}: Pass URLs specified directly verbatim to FileTransferRequest
The URL should not be normalized before handing it off to cURL, because
builtin fetchers like fetchTarball/fetchurl are expected to work with
arbitrary URLs, that might not be RFC3986 compliant. For those cases
Nix should not normalize URLs, though validation is fine. ParseURL and
cURL are supposed to match the set of acceptable URLs, since they implement
the same RFC.
2025-09-01 02:22:23 +03:00
Emily
acd627fa46
tests/functional/lang: Add tests for builtins.fromTOML overflow
This adds regression tests for fromTOML overflow/underflow behavior.
Previous versions of toml11 used to saturate, but this was never an
intended behavior (and Snix/Nix 2.3/toml11 >= 4.0 validate this).

(cherry picked from Lix [1,2])

[1]: 7ee442079d
[2]: 4de09b6b54
2025-09-01 01:49:15 +03:00
Sergei Zimmerman
8251305aff
Reapply "Merge pull request #13741 from xokdvium/toml-timestamps"
This reverts commit 75740fbd75.
2025-09-01 01:26:14 +03:00
John Ericson
169033001d Simplify handling of statuses for build errors
Instead of passing them around separately, or doing finicky logic in a
try-catch block to recover them, just make `BuildError` always contain a
status, and make it the thrower's responsibility to set it. This is much
more simple and explicit.

Once that change is done, split the `done` functions of `DerivationGoal`
and `DerivationBuildingGoal` into separate success and failure
functions, which ends up being easier to understand and hardly any
duplication.

Also, change the handling of failures in resolved cases to use
`BuildResult::DependencyFailed` and a new message. This is because the
underlying derivation will also get its message printed --- which is
good, because in general the resolved derivation is not unique. One dyn
drv test had to be updated, but CA (and dyn drv) is experimental, so I
do not mind.

Finally, delete `SubstError` because it is unused.
2025-08-27 20:05:06 -04:00
Jörg Thalheim
725a2f379f don't include derivation name in temporary build directories
With the migration to /nix/var/nix/builds we now have failing builds
when the derivation name is too long.
This change removes the derivation name from the temporary build to have
a predictable prefix length:

Also see: https://github.com/NixOS/infra/pull/764
for context.
2025-08-27 09:48:31 +02:00
Sergei Zimmerman
03101cc839
treewide: Bump C++ standard version to C++23
Compilers in nixpkgs have caught up and major distros
should also have recent enough compilers. It would be
nice to have newer features like more full featured
ranges and deducing this.
2025-08-19 15:33:27 +03:00
tomberek
dc2478fe79
Merge pull request #13340 from mkenigs/better-error
Improve error when can't acquire db lock
2025-08-18 15:27:58 -04:00
Sergei Zimmerman
1d943f5819
flake: Apply nixfmt 1.0.0 2025-08-18 20:29:45 +03:00
John Ericson
3e7879e6df Rewrite StoreConfig::getUri in terms of new StoreConfig::getReference
Rather than having store implementations return a free-form URI string,
have them return a `StoreReference`. This reflects that fact that this
method is supposed to invert `resolveStoreConfig`, which goes from a
`StoreReference` to some `StoreConfig` concrete derived class (based on
the registry).

`StoreConfig::getUri` is kept only as a convenience for the common case
that we want to immediately render the `StoreReference`.

A few tests were changed to use `local://` not `local`, since
`StoreReference` does not encode the `local` and `daemon` shorthands
(and instead desugars them to `local://` and `unix://` right away). I
think that is fine. `local` and `daemon` still work as input.
2025-08-13 19:06:59 -04:00
Jörg Thalheim
75740fbd75 Revert "Merge pull request #13741 from xokdvium/toml-timestamps"
This reverts commit 53ac49f72c, reversing
changes made to 8e5ca787f4.

This broke nixpkgs eval test that was depending overflowing integers...
2025-08-13 22:46:09 +02:00
Sergei Zimmerman
7ed0229d1a
tests/functional/lang: Add more tests for TOML timestamps
Current test suite doesn't cover the subsecond formatting at
all and toml11 is quite finicky with that. We should at the very
least test its behavior to avoid silent breakages on updates.
2025-08-12 14:28:39 +03:00
Sergei Zimmerman
e8e9376a7b
libfetchers: Remove badGitRefRegex and use libgit2 for reference validation
Fixes usage of `#` symbol in the reference name.
This also seems to identify several deficiencies in the libgit2 refname
validation code wrt to DEL symbol and a singular `@` symbol [1].

[1]: https://git-scm.com/docs/git-check-ref-format#_description
2025-08-11 02:38:45 +03:00
Farid Zakaria
bf320465ae
Make functional tests depend on nix binary so they auto recompile
With this I'm able to do a fresh config + meson test with all dependencies
correctly propagated.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
2025-08-08 03:18:38 +03:00
Sergei Zimmerman
385e2c3542
meson: Apply formatting universally
Now that we have applied the [1] patch, the diff is much
nicer and less noisy.

[1]: https://www.github.com/mesonbuild/meson/pull/14861
2025-08-07 02:58:29 +03:00
Sergei Zimmerman
bf80696ed9
meson: Get rid of multiline array formatting hack 2025-08-07 02:57:02 +03:00
Sergei Zimmerman
53492c0ecd
Merge pull request #13555 from k1gen/no-url-literals-test
Add functional test for no-url-literals experimental feature
2025-08-06 11:29:08 +03:00
Sergei Zimmerman
4333a9d5a8
ci: Collect code coverage in tests
This adds the necessary infrastructure to collect
code coverage in CI, which could be useful to look
at munually or track consistently via something like
codecov.

Co-authored-by: Jade Lovelace <lix@jade.fyi>
2025-08-04 23:50:02 +03:00
Oleksandr Knyshuk
6e8f76482e
Add functional test for no-url-literals experimental feature
Closes: #13533
2025-07-31 15:34:49 +02:00
Oleksandr Knyshuk
6d46dc9f6a
Add warn-short-path-literals setting
Add a new setting to warn about path literals that don't start with "." or "/". When enabled,
expressions like `foo/bar` will emit a warning suggesting to use `./foo/bar` instead.

A functional test is included.

The setting defaults to false for backward compatibility but could eventually default to true in
the future.

Closes: #13374

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-07-29 15:47:58 +02:00
John Ericson
d21e3f88ec Implement support for Git hashing with SHA-256
SHA-256 is Git's next hash algorithm. The world is still basically stuck
on SHA-1 with git, but shouldn't be. We can at least do our part to get
ready.

On the C++ implementation side, only a little bit of generalization was
needed, and that was fairly straight-forward. The tests (unit and
system) were actually bigger, and care was taken to make sure they were
all cover both algorithms equally.
2025-07-25 10:19:08 -04:00
Eelco Dolstra
54dc5314e8 Fix nix_system_cpu on i686-linux
Fixes #13532.
2025-07-24 18:06:06 +02:00