Commit graph

18669 commits

Author SHA1 Message Date
Valentin Gagarin
96ba7f9d77
Merge pull request #11626 from fricklerhandwerk/nix-install-instruction
doc: don't use bash substitution in install command
2024-10-01 22:51:10 +02:00
Valentin Gagarin
b6656160ba doc: don't use bash substitution in install command 2024-10-01 17:28:43 +02:00
Eelco Dolstra
3e7b42dd89
Merge pull request #11618 from NixOS/ignoreException-interrupt
Split ignoreException for destructors vs interrupt-safe
2024-10-01 17:10:39 +02:00
Eelco Dolstra
96c326a7bf
Merge pull request #11623 from NixOS/dependabot/github_actions/cachix/install-nix-action-v29
Bump cachix/install-nix-action from V28 to 29
2024-10-01 17:03:27 +02:00
Robert Hensing
417d5565b1
Merge pull request #11619 from NaN-git/fix-disable-gc
fix: include missing header when GC is disabled
2024-10-01 14:55:22 +02:00
Robert Hensing
dc89eab7f4
Merge pull request #11620 from NaN-git/cleanup-eval
eval: remove superfluous strdup
2024-10-01 14:48:29 +02:00
Valentin Gagarin
b7b9acd080
Merge pull request #11621 from kevincox/patch-1
Improve documentation of `nix flake lock`
2024-10-01 08:33:13 +02:00
dependabot[bot]
348cca088c
Bump cachix/install-nix-action from V28 to 29
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V28 to 29. This release includes the previously tagged commit.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/V28...v29)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 22:28:36 +00:00
Kevin Cox
d2f627dda9
Improve documentation of nix flake lock
The previous documentation was inaccurate, stating that it would not update existing inputs. However these inputs will be updated if they are outdated (for example the version of an existing input has been changed). The new text properly reflects this behaviour.
2024-09-30 17:27:49 -04:00
Philipp Otterbein
5cf6b2cb75 eval: remove superfluous strdup 2024-09-30 22:15:04 +02:00
Philipp Otterbein
c7db10000c fix: include missing header when GC is disabled 2024-09-30 21:27:06 +02:00
tomberek
14f029dbe8
Merge pull request #11489 from bryanhonof/bryanhonof.warn-on-malformed-uri-query
fix: warn on malformed URI query parameter
2024-09-30 12:14:40 -04:00
Yann Hamdaoui
f8268cbe16
Fix NAR tests on Linux+ZFS+normalize
A test added recently checks that when trying to deserialize a NAR with
two files that Unicode-normalize to the same result either succeeds on
Linux, or fails with an "already exists" error on Darwin. However,
failing with an "already exists" error can in fact also happen on Linux,
when using ZFS with the proper utf8 and Unicode normalization options
set.

This commit fixes the issue by not assuming the behavior from the
current system, but just by blindly checking that either one of the two
aforementioned possibilities happen, whether on Darwin or on Linux.

Additionally, we check that the Unicode normalization behaviour of
nix-store is the same as the host file system.
2024-09-30 16:29:51 +02:00
Bryan Honof
5150a962f5
test(functional/flakes): add dubious-query
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2024-09-30 14:44:06 +02:00
Bryan Honof
1f024ecfcd
fix: warn on malformed URI query parameter 2024-09-30 14:44:06 +02:00
Robert Hensing
c116030605
Merge pull request #11602 from Mic92/macos-test-fix
tests/functional/flakes/run: fix tests in macOS devshell
2024-09-30 13:37:54 +02:00
Robert Hensing
4e31360637
Reference issue in tests/functional/flakes/run.sh 2024-09-30 13:02:51 +02:00
Robert Hensing
3df619339c Split ignoreException for destructors or interrupt-safe 2024-09-30 11:50:25 +02:00
Valentin Gagarin
a1415471b8
Merge pull request #11611 from jljusten/spelling-fixes 2024-09-30 01:20:40 +02:00
tomberek
973d4ede84
Merge pull request #11614 from Gerg-L/master
nix-ng: add meta.mainProgram
2024-09-29 18:28:56 -04:00
Gerg-L
a614fbb2a2
nix-ng: add meta.mainProgram 2024-09-29 15:04:41 -04:00
Valentin Gagarin
79138183a9
Merge pull request #11613 from NixOS/nix-fmt-doc
doc/nix fmt: Do not document behavior we do not control
2024-09-29 20:48:43 +02:00
Robert Hensing
8c4842de8c doc/nix fmt: Do not document behavior we do not control
This leads to confusion about what the command does.
E.g. https://github.com/NixOS/nix/issues/9359

- Move the description up

- Remove details about the individual formatters
2024-09-29 19:53:36 +02:00
Jordan Justen
3b6cf350e7
doc, src: Fix various spelling typos
Signed-off-by: Jordan Justen <jljusten@gmail.com>
2024-09-28 15:29:15 -07:00
Jörg Thalheim
410853ddcf tests/nixos/fetchurl: drop unused variables 2024-09-28 17:08:18 +02:00
Puck Meerburg
c1ecf0bee9 fix passing CA files into builtins:fetchurl sandbox
This patch has been manually adapted from
14dc84ed03

Tested with:

$ NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
Finished at 16:57:50 after 1s
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> error:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>        … writing file '/nix/store/0zynn4n8yx59bczy1mgh1lq2rnprvvrc-google.com'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com>        error: unable to download 'https://google.com': Problem with the SSL CA cert (path? access rights?) (77) error setting certificate file: /nix/store/nlgbippbbgn38hynjkp1ghiybcq1dqhx-nss-cacert-3.101.1/etc/ssl/certs/ca-bundle.crt
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
error: builder for '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv' failed with exit code 1

Now returns:

nix-env % NIX_SSL_CERT_FILE=$(nix-build '<nixpkgs>' -A cacert)/etc/ssl/certs/ca-bundle.crt nix-build --store $(mktemp -d) -E 'import <nix/fetchurl.nix> { url = https://google.com; }'
Finished at 17:05:48 after 0s
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
this derivation will be built:
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
  /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
google.com> building '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv'
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
nix-output-monitor error: DerivationReadError /nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv: openFile: does not exist (No such file or directory)
error: hash mismatch in fixed-output derivation '/nix/store/4qljhy0jj2b0abjzpsbyarpia1bqylwc-google.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
2024-09-28 17:08:16 +02:00
Eelco Dolstra
08deebddf2
Merge pull request #11600 from DeterminateSystems/fix-uncaught-exception
HttpBinaryCacheStore::getFile(): Fix uncaught exception
2024-09-27 12:37:12 +02:00
Eelco Dolstra
f8bd7e7e5c
Merge pull request #11598 from joshheinrichs-shopify/fix-http-cache-reference
Fix reference to HTTP Binary Cache Store in docs
2024-09-27 11:43:41 +02:00
Jörg Thalheim
3b0c5ab835 tests/functional/flakes/run: fix tests in macOS devshell
same fix as in 04a47e93f6
2024-09-27 11:07:50 +02:00
Valentin Gagarin
aee34e4776
fix location 2024-09-27 11:07:04 +02:00
Eelco Dolstra
4566854981 HttpBinaryCacheStore::getFile(): Fix uncaught exception
This method is marked as `noexcept`, but `enqueueFileTransfer()` can
throw `Interrupted` if the user has hit Ctrl-C or if the `ThreadPool`
that the thread is a part of is shutting down.
2024-09-27 00:16:52 +02:00
Eelco Dolstra
0ed67e5b7e
Merge pull request #11581 from Mic92/git-cache
create git caches atomically
2024-09-26 21:58:22 +02:00
Josh Heinrichs
1271a95b79
Fix reference to HTTP Binary Cache Store in docs 2024-09-26 12:30:41 -06:00
Jörg Thalheim
12d5b2cfa1 create git caches atomically
When working on speeding up the CI,
I triggered a race condition in the creation of the tarball cache.
This code now instead will ensure that half-initialized repositories
are no longer visible to any other nix process.

This is the error message that I got before:

error: opening Git repository '"/Users/runner/.cache/nix/tarball-cache"': could not find repository at '/Users/runner/.cache/nix/tarball-cache'
2024-09-26 17:46:25 +02:00
Jason Yundt
a5959aa121
docs: specify that flake.lock files are JSON (#11594)
* docs: specify that flake.lock files are JSON

Recently, I decided that I was going to write some code that would parse
flake.lock files. I went to the Nix Reference Manual in order to look up
information on the format of flake.lock files, and I realized that a key
detail was missing from the Nix Reference Manual: it never says that
flake.lock files are JSON files. This commit fixes that issue.

This commit makes sure to specify that flake.lock files are encoded in
UTF-8. Confusingly, there’s multiple different JSON standards. Neither
ECMA-404, 2nd Edition [1] nor ISO/IEC 21778:2017 [2] mention UTF-8. RFC
8259 requires UTF-8, but only sometimes [3]. I chose to explicitly
specify that flake.lock files are UTF-8 in order to avoid any possible
ambiguities from the JSON standards.

[1]: <https://ecma-international.org/publications-and-standards/standards/ecma-404>
[2]: <https://www.iso.org/standard/71616.html>
[3]: <https://www.rfc-editor.org/rfc/rfc8259.html#section-8.1>
2024-09-26 00:21:33 +00:00
Eelco Dolstra
4dc4e81b1e
Merge pull request #11593 from DeterminateSystems/typo
Fix typo
2024-09-26 00:55:46 +02:00
Eelco Dolstra
ef8987955b Typo 2024-09-26 00:15:04 +02:00
Eelco Dolstra
062b4a489e
Merge pull request #11585 from NixOS/verify-tls
builtin:fetchurl: Enable TLS verification
2024-09-25 23:52:25 +02:00
Eelco Dolstra
7b39cd631e Add release note 2024-09-25 23:07:11 +02:00
Valentin Gagarin
6c37d81514
Merge pull request #11584 from Mic92/devdocs 2024-09-25 13:44:49 +02:00
Jörg Thalheim
eb3a368a33 docs/testing: add --verbose flag for running single tests
Most of the time people run single tests for debugging reason,
so it's a sane default to have them see all the console output.

This commit still retains the section about running tests directly with
meson, because in some debugging cases it's just nice to have less
abstractions i.e. when using strace.
2024-09-25 09:46:29 +02:00
Eelco Dolstra
f2f47fa725 Add a test for builtin:fetchurl cert verification 2024-09-24 16:13:28 +02:00
John Ericson
322d2c767f
Merge pull request #11523 from obsidiansystems/base64Decode-no-leak-private-key-on-error
Ensure error messages don't leak private key
2024-09-23 17:13:32 -04:00
John Ericson
2b6b03d8df Ensure error messages don't leak private key
Since #8766, invalid base64 is rendered in errors, but we don't actually
want to show this in the case of an invalid private keys.

Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
2024-09-23 16:36:48 -04:00
Eelco Dolstra
c04bc17a5a builtin:fetchurl: Enable TLS verification
This is better for privacy and to avoid leaking netrc credentials in a
MITM attack, but also the assumption that we check the hash no longer
holds in some cases (in particular for impure derivations).

Partially reverts 5db358d4d7.
2024-09-23 15:15:43 +02:00
Ryan Hendrickson
da332d678e libexpr: deprecate the bogus "or"-as-variable
As a prelude to making "or" work like a normal variable, emit a warning
any time the "fn or" production is used in a context that will change
how it is parsed when that production is refactored.

In detail: in the future, OR_KW will be moved to expr_simple, and the
cursed ExprCall production that is currently part of the expr_select
nonterminal will be generated "normally" in expr_app instead. Any
productions that accept an expr_select will be affected, except for the
expr_app nonterminal itself (because, while expr_app has a production
accepting a bare expr_select, its other production will continue to
accept "fn or" expressions). So all we need to do is emit an appropriate
warning when an expr_simple representing a cursed ExprCall is accepted
in one of those productions without first going through expr_app.

As the warning message describes, users can suppress the warning by
wrapping their problematic "fn or" expressions in parentheses. For
example, "f g or" can be made future-proof by rewriting it as
"f (g or)"; similarly "[ x y or ]" can be rewritten as "[ x (y or) ]",
etc. The parentheses preserve the current grouping behavior, as in the
future "f g or" will be parsed as "(f g) or", just like
"f g anything-else" is grouped. (Mechanically, this suppresses the
warning because the problem ExprCalls go through the
"expr_app : expr_select" production, which resets the cursed status on
the ExprCall.)
2024-09-20 15:57:36 -04:00
John Ericson
d0c351bf43 Revert "base64Decode: clearer error message when an invalid character is detected"
We have a safer way of doing this.

This reverts commit dc3ccf02bf.
2024-09-20 10:41:45 -04:00
Eelco Dolstra
68ba6ff470
Merge pull request #11558 from DeterminateSystems/fix-no-gc-build
Fix build without GC
2024-09-20 16:02:08 +02:00
Eelco Dolstra
ec47133be3 Fix warning 2024-09-20 15:08:45 +02:00
Eelco Dolstra
088569463b Fix build without GC 2024-09-20 15:01:32 +02:00