Commit graph

2659 commits

Author SHA1 Message Date
Cameron Dart
58a653dcc6 housekeeping: shellcheck for tests/functional/compression-levels.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
48520cb71e housekeeping: shellcheck for tests/functional/chroot-store.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
63272235e2 housekeeping: shellcheck for tests/functional/case-hacks.sh
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2024-06-12 17:41:16 -04:00
Cameron Dart
4f04006bc1 housekeeping: shellcheck for tests/functional/check-reqs.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
d7bb5bde48 housekeeping: shellcheck for tests/functional/check-refs.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
259b502773 housekeeping: shellcheck for tests/functional/ca/substitute.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
04876c39e4 housekeeping: shellcheck for tests/functional/ca/signatures.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
8f85537629 housekeeping: shellcheck for tests/functional/ca/nix-run.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
deacc421eb housekeeping: shellcheck for tests/functional/ca/nix-copy.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
195c0da849 housekeeping: shellcheck for tests/functional/ca/duplicate-realisation-in-closure.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
2dfbba3e5e housekeeping: shellcheck for tests/functional/ca/derivation-json.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
627176fd54 housekeeping: shellcheck for tests/functional/ca/build.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
80c44138cb housekeeping: shellcheck for tests/functional/ca/build-cache.sh
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2024-06-12 17:41:16 -04:00
Cameron Dart
c127625095 housekeeping: shellcheck for tests/functional/build-dry.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
f615489e0e housekeeping: shellcheck for tests/functional/build-delete.sh 2024-06-12 17:41:16 -04:00
Cameron Dart
7186c68f75 housekeeping: shellcheck for tests/functional/brotli.sh
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2024-06-12 17:41:15 -04:00
Cameron Dart
aeed835a2e housekeeping: shellcheck for tests/functional/binary-cache.sh
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2024-06-12 17:41:08 -04:00
Cameron Dart
4a28ba7877 housekeeping: shellcheck for tests/functional/binary-cache-build-remote.sh 2024-06-12 16:58:25 -04:00
Cameron Dart
7738b295e5 housekeeping: shellcheck for tests/functional/bash-profile.sh 2024-06-12 16:58:25 -04:00
John Ericson
7c2981fc55 Fix FreeBSD build
This restores some CPP'd code that was added in
c18911602e and accidentally lost in
2477e4e3b8.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-06-12 15:59:54 -04:00
Eelco Dolstra
bd37a70d8f
Update tests/functional/tarball.sh
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-06-11 19:39:42 +02:00
Eelco Dolstra
35bdb9cee7 Support hard links in tarballs
Fixes #10395.
2024-06-11 16:05:57 +02:00
Robert Hensing
de3fd52a95 Add tests/f/lang/eval-okay-derivation-legacy 2024-06-10 16:31:46 +02:00
John Ericson
b0283240a1
Merge pull request #10864 from Mic92/tarball-flakes-test
tests/nixos: make the tarball-flakes test better reflect real use cases
2024-06-05 18:40:16 -04:00
John Ericson
1a32490aca
Merge pull request #10835 from hercules-ci/update-nixpkgs-24.05
Update to Nixpkgs 24.05
2024-06-05 17:56:16 -04:00
Pierre Bourdon
162d94d975 tests/nixos: make the tarball-flakes test better reflect real use cases
In most real world cases, the Link header is set on the redirect, not on
the final file. This regressed in Lix earlier and while new unit tests
were added to cover it, this integration test should probably have also
caught it.

Source: a3256a9375
2024-06-05 20:14:24 +02:00
Robert Hensing
5d460d563e TMP: Disable tests.setuid.i686-linux
Temporarily(?) blocked on https://github.com/NixOS/nixpkgs/pull/297475#issuecomment-2145589501
2024-06-03 18:47:53 +02:00
Robert Hensing
27f880c098 Format after clang-format update 2024-06-03 18:38:56 +02:00
Robert Hensing
8a510f4ede Add tests.remoteBuilds_*_2_18 2024-06-03 17:34:55 +02:00
Robert Hensing
efc2508e8b Refactor hydraJobs.tests.remoteBuilds_*_2_18 2024-06-03 17:34:55 +02:00
Robert Hensing
6558025e77 Fix eval remoteBuilds_*_2_13 2024-06-03 17:34:55 +02:00
Robert Hensing
449e4b9232 Change checkOverrideNixVersion for NixOS 24.05 2024-06-03 17:34:55 +02:00
Eelco Dolstra
da92ad7dd2
Merge pull request #10592 from hercules-ci/builtins-warn
Add `builtins.warn`
2024-06-03 17:16:32 +02:00
Robert Hensing
da82d67022 builtins.warn: Require string argument
... so that we may perhaps later extend the interface.
Note that Nixpkgs' lib.warn already requires a string coercible
argument, so this is reasonable. Also note that string coercible
values aren't all strings, but in practice, for warn, they are.
2024-06-03 16:24:21 +02:00
Robert Hensing
2d4c9d8f4a Add builtins.warn 2024-06-03 16:24:21 +02:00
Eelco Dolstra
54a9fbe5d6 Merge remote-tracking branch 'origin/master' into large-path-warning 2024-06-03 16:17:52 +02:00
Eelco Dolstra
d07cdbd9c2
Merge pull request #10834 from obsidiansystems/fix-shellcheck
Fix shellcheck issue
2024-06-03 16:14:41 +02:00
Eelco Dolstra
ac3e5d22e3
Merge pull request #10028 from DavHau/fetchTree-shallow-default
fetchTree: shallow git fetching by default
2024-06-03 16:02:34 +02:00
John Ericson
1e99f324d9 Fix shellcheck issue
8b86f415c1 was merged from a CI run that
predated the new linting.
2024-06-03 09:36:48 -04:00
Eelco Dolstra
7f5b57d18f Merge remote-tracking branch 'origin/master' into large-path-warning 2024-06-03 15:32:27 +02:00
Eelco Dolstra
ecfad6a828
Merge pull request #10564 from edolstra/remove-forceErrors
AttrCursor: Remove forceErrors
2024-06-03 15:30:01 +02:00
Eelco Dolstra
d16fcaee21
Merge pull request #10782 from obsidiansystems/both-connections
Factor our connection code for worker proto like serve proto
2024-06-03 15:10:38 +02:00
John Ericson
c6add8873e
Merge pull request #9995 from NixOS/json-empty-sigs
`ValidPathInfo` JSON format should use `null` not omit field
2024-06-03 08:58:49 -04:00
Robert Hensing
de5050f73b
Merge pull request #9590 from wh0/patch-1
nix-profile: fix both profile links detection
2024-06-03 14:37:08 +02:00
John Ericson
84c65135a5 ValidPathInfo JSON format should use null not omit field
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-06-03 08:21:22 -04:00
Robert Hensing
f8bd4ba561
Merge pull request #10827 from SkamDart/skamdart/functional-add-sc
housekeeping: shellcheck test/functional/add.sh
2024-06-03 12:31:39 +02:00
Cameron Dart
6a507f5d3b housekeeping: shellcheck test/functional/add.sh 2024-06-02 13:41:51 -07:00
Ivan Trubach
68090d7ff1 Fix empty outputsToInstall for InstallableAttrPath
Fixes assertion failure if outputsToInstall is empty by defaulting to the "out"
output. That is, behavior between the following commands should be consistent:

	$ nix build --no-link --json .#nothing-to-install-no-out
	error: derivation '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-nothing-to-install-no-out.drv' does not have wanted outputs 'out'

	$ nix build --no-link --file default.nix --json nothing-to-install-no-out
	error: derivation '/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-nothing-to-install-no-out.drv' does not have wanted outputs 'out'

Real-world example of this issue:

	$ nix build --json .#.legacyPackages.aarch64-linux.texlive.pkgs.iwona
	error: derivation '/nix/store/dj0h6b0pnlnan5nidnhqa0bmzq4rv6sx-iwona-0.995b.drv' does not have wanted outputs 'out'

	$ git rev-parse HEAD
	eee33247cf6941daea8398c976bd2dda7962b125
	$ nix build --json --file . texlive.pkgs.iwona
	nix: src/libstore/outputs-spec.hh:46: nix::OutputsSpec::Names::Names(std::set<std::__cxx11::basic_string<char> >&&): Assertion `!empty()' failed.
	Aborted (core dumped)
2024-06-02 14:26:18 +03:00
Robert Hensing
802b4e403b
Merge pull request #10814 from Mic92/fix-nix-edit
Fix nix edit
2024-05-31 13:30:24 +02:00
Jörg Thalheim
69c159811e add regression test for nix edit 2024-05-31 12:58:47 +02:00
Robert Hensing
c692f6af13 nix env shell: Move from nix shell, add shorthand alias 2024-05-30 19:41:58 +02:00
John Ericson
10f864c5ae Ensure all functional scripts are (a) executable (b) have shebang
This is good for shebang, and also good for future build system
simplifications
2024-05-28 12:46:24 -04:00
John Ericson
2e12b58126 Shellcheck some test scripts
Progress on #10795
2024-05-28 12:32:22 -04:00
John Ericson
1e2b26734b
Merge pull request #10799 from hercules-ci/safer-tab-completion
Add repl completion test
2024-05-28 11:30:56 -04:00
John Ericson
567265ae67 Start getting all shell scripts passing shellcheck
Like with the formatter, we are blacklisting most files by default.

Do a few files to get us started, and get a sense of what this looks
like.
2024-05-27 22:39:56 -04:00
Robert Hensing
ebfada36a1 Add repl completion test 2024-05-27 09:58:49 +02:00
John Ericson
f71b4da0b3 Factor our connection code for worker proto like serve proto
This increases test coverage, and gets the worker protocol ready to be
used by Hydra.

Why don't we just try to use the store interface in Hydra? Well, the
problem is that the store interface works on connection pools, with each
opreation getting potentially a different connection, but the way temp
roots work requires that we keep one logical "transaction" (temp root
session) using the same connection.

The longer-term solution probably is making connections themselves
implement the store interface, but that is something that builds on
this, so I feel OK that this is not churn in the wrong direction.

Fixes #9584
2024-05-27 00:43:46 -04:00
John Ericson
eeb89c28b0 Worker proto use proper serialiser for BuildMode
Do this instead of an unchecked cast

I redid this to use the serialisation framework (including a unit test),
but I am keeping the reference to credit Jade for spotting the issue.

Change-Id: Icf6af7935e8f139bef36b40ad475e973aa48855c
(adapted from commit 2a7a824d83dc5fb33326b8b89625685f283a743b)

Co-Authored-By: Jade Lovelace <lix@jade.fyi>
2024-05-27 00:22:55 -04:00
John Ericson
5cfa75ea16
Merge pull request #10737 from poweredbypie/mingw-stackSize
Implement `setStackSize` on Windows
2024-05-25 09:56:02 -04:00
John Ericson
e0c94b91ee
Merge pull request #10757 from obsidiansystems/fix-4977
Require `drvPath` attribute to end with `.drv`
2024-05-24 12:14:59 -04:00
Eelco Dolstra
8b86f415c1 Add test for the evaluation cache 2024-05-24 16:34:49 +02:00
PoweredByPie
0b7da099d1 Commit more stack size in some windows binaries
This way we can commit the same amount of stack size (64 MB) without a conditional.
Includes nix, libnixexpr-tests, libnixfetchers-tests, libnixstore-tests, libnixutil-tests.
2024-05-23 17:42:55 -07:00
Robert Hensing
97c3463291 C API: Refactor: use NIX_VALUE_CALL 2024-05-23 21:25:23 +02:00
Robert Hensing
2497d10351 C API: Add nix_value_call_multi, NIX_VALUE_CALL
_multi can be implemented more efficiently.
NIX_VALUE_CALL is a convenient way to invoke it.
2024-05-23 21:24:06 +02:00
Robert Hensing
ab106c5ca3 C API: Test arity 2 primop 2024-05-23 21:23:15 +02:00
Robert Hensing
8ef6efc184 C API: Require non-thunk value from primop definition 2024-05-23 21:22:59 +02:00
Robert Hensing
8884227045 C API: Require initialized value from primop definition 2024-05-23 21:22:21 +02:00
Robert Hensing
a942a34469 C API: Fix nix_c_primop_wrapper for strict initializers
https://github.com/NixOS/nix/pull/10555 added a check requiring
that output parameters always have an uninitialized Value as argument.

Unfortunately the output parameter of the primop callback received
a thunk instead.

See the comment for implementation considerations.
2024-05-23 18:32:49 +02:00
John Ericson
f2bcebc450 Restore exposing machine file parsing
This was accidentally removed in
e989c83b44. I restored it and also did a
few other cleanups:

- Make a static method for namespacing purposes

- Put the test files in the data dir with the other test data

- Avoid mutating globals in the machine config tests

This will be used by Hydra.
2024-05-23 00:03:52 -04:00
John Ericson
f923ed6b6a Require drvPath attribute to end with .drv
Fixes #4977
2024-05-22 12:50:24 -04:00
John Ericson
b3ebcc5aad Use the new StoreReference in Machine
This makes the remote builder abstract syntax more robust.
2024-05-22 09:20:15 -04:00
John Ericson
b59a7a14c4 Add StoreReference::render
This will be needed for the next step.

Also allows us to write round trip tests.
2024-05-22 09:20:15 -04:00
John Ericson
1d6c2316a9 Slightly change formatting style
For long expressions, one argument or parameter per line is just easier.
2024-05-22 09:20:15 -04:00
John Ericson
470c0501eb Ensure all store types support "real" URIs
In particular `local://<path>` and `unix://` (without any path) now
work, and mean the same things as `local` and `daemon`, respectively. We
thus now have the opportunity to desguar `local` and `daemon` early.

This will allow me to make a change to
https://github.com/NixOS/nix/pull/9839 requested during review to
desugar those earlier.

Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-05-21 11:56:40 -04:00
John Ericson
8b369f90fd Query path infos (plural) and handshake version minimum for hydra
1. Hydra currently queries for multiple path infos at once, so let us
   make a connection item for that.

2. The minimum of the two versions should always be used, see #9584.
   (The issue remains open because the daemon protocol needs to be
   likewise updated.)
2024-05-20 17:43:18 -04:00
Robert Hensing
67db9e0c64
Merge pull request #10722 from obsidiansystems/ca-obj-docs
Content addressing store objects
2024-05-20 15:58:29 +02:00
John Ericson
1c75af969a Document store object content addressing & improve JSON format
The JSON format no longer uses the legacy ATerm `r:` prefixing nonsese,
but separate fields.

Progress on #9866

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-05-20 09:34:35 -04:00
Robert Hensing
e4be8abe42
Merge pull request #10701 from cole-h/nix-command-warn-unknown-settings
Warn on unknown settings when the first positional is an argument
2024-05-20 15:15:13 +02:00
Maximilian Bosch
19720d733f nix3-build: show all FOD errors with --keep-going
Basically I'd expect the same behavior as with `nix-build`, i.e.
with `--keep-going` the hash-mismatch error of each failing
fixed-output derivation is shown.

The approach is derived from `Store::buildPaths` (`entry-point.cc`):
instead of throwing the first build-result, check if there are any build
errors and if so, display all of them and throw after that.

Unfortunately, the BuildResult struct doesn't have an `ErrorInfo`
(there's a FIXME for that at least), so I have to construct my own here.
This is a rather cheap bugfix and I decided against touching too many
parts of libstore for that (also I don't know if that's in line with the
ongoing refactoring work).

Closes https://git.lix.systems/lix-project/lix/issues/302

Change-Id: I378ab984fa271e6808c6897c45e0f070eb4c6fac
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
2024-05-17 18:48:52 +02:00
Eelco Dolstra
3026613893
Merge pull request #10675 from edolstra/zip-symlinks
Handle zip files containing symlinks
2024-05-15 22:07:22 +02:00
Cole Helbling
06e13465c5 tests/functional: test both clis warn on unknown settings 2024-05-15 12:25:03 -07:00
Eelco Dolstra
1da18e85ba tests/functional/common/init.sh: Make $TEST_ROOT writable before removing it
$TEST_ROOT typically contains read-only files/directories (e.g. the
Nix store). So we have to make it writable first.
2024-05-14 16:23:08 +02:00
Eelco Dolstra
9a58d90c73 tests/nixos/containers/containers.nix: Remove superfluous -v 2024-05-14 14:27:09 +02:00
Valentin Gagarin
7822ecbadf tests: always clean the test directory
previously the test directory could have been left untouched before executing
a test when `init.sh` was not run - and sometimes it isn't
supposed to be run - which made the test suite highly stateful and thus
behaving surprisingly on multiple runs.
2024-05-13 15:19:49 +02:00
Valentin Gagarin
33ca905cdb tests: simplify initialisation and wiring
pararameterisation is not actually needed the way things are currently
set up, and it confused me when trying to understand what the code does.

all but one test sources vars-and-functions.sh, which nominally only
defines variables, but in practice is always coupled with the actual
initialisation. while the cleaner way of making this more legible would
be to source variables and initialisation separately, this would produce
a huge diff.

the change requires a few small fixes to keep the tests working:

- only create test home directory during initialisation

  that vars-and-functions.sh wrote to the file system seems not write

- fix creation of the test directory

  due to statefulness, the test home directory was implicitly creating
  the test root, too. decoupling that made it apparent that this was
  probably not intentional, and certainly confusing.

- only source vars-and-functions.sh if init.sh is not needed

  there is one test case that only needs a helper function but no
  initialisation side effects

- remove some unnecessary cleanups and split parts of re-used test code

  there were confusing bits in how initialisation code was repurposed,
  which break if trying to refactor the outer layers naively...
2024-05-13 15:19:49 +02:00
Eelco Dolstra
f0b5628eb2 renderSize(): Add some unit tests 2024-05-13 12:08:51 +02:00
Robert Hensing
c940d11fb0
Merge pull request #10666 from tie/derivation-outputs-drv-path
Forbid drvPath in strictDerivation outputs attribute
2024-05-12 21:14:32 +02:00
Eelco Dolstra
9951e14ae0 Handle zip files containing symlinks
In streaming mode, libarchive doesn't handle symlinks in zip files
correctly. So write the entire file to disk so libarchive can access
it in random-access mode.

Fixes #10649. This was broken in cabee98152.
2024-05-09 19:33:09 +02:00
Eelco Dolstra
79c7d6205c Support unit prefixes in configuration settings
E.g. you can now say `--min-free 1G`.
2024-05-08 21:11:09 +02:00
Ivan Trubach
081faeda8c Forbid drvPath in strictDerivation outputs attribute
builtins.strictDerivation returns an attribute set with drvPath and
output paths. For some reason, current implementation forbids drv
instead of drvPath.
2024-05-08 18:20:37 +03:00
ramboman
b4950404ba
Honor the same set of proxy environment variables (#10611)
Different parts of the project honor different sets of proxy environment
variables. With this commit all parts of the project will honor the same
set of proxy environment variables.

---------

Co-authored-by: Your Name <you@example.com>
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2024-05-06 15:39:22 -04:00
Eelco Dolstra
da3381d51f
Merge pull request #10465 from edolstra/remove-locked
Fetcher cache cleanups
2024-05-06 21:32:26 +02:00
John Ericson
1ad7b5451d
Merge pull request #10655 from edolstra/use-source-path
Use `SourcePath` in more places
2024-05-06 14:57:01 -04:00
John Ericson
5e189025ca Fix build failure with clang
A slight issue with feb1d10f60.
2024-05-06 13:39:21 -04:00
Eelco Dolstra
eab2919119 Use SourcePath in more places
Now that SourcePath uses a SourceAccessor instead of an InputAccessor,
we can use it in function signatures instead of passing a
SourceAccessor and CanonPath separately.
2024-05-06 19:05:42 +02:00
Eelco Dolstra
2926ef0e90
Merge pull request #10652 from tweag/check-additionalSandboxProfile
libstore: check additionalSandboxProfile
2024-05-06 17:59:25 +02:00
Théophane Hufschmitt
9bd1191fcc libstore: check additionalSandboxProfile
Make sure that `extraSandboxProfile` is set before we check whether it's
empty or not (in the `sandbox=true` case).

Also adds a test case for this.

Co-Authored-By: Artemis Tosini <lix@artem.ist>
Co-Authored-By: Eelco Dolstra <edolstra@gmail.com>
2024-05-06 17:37:08 +02:00
HaeNoe
feb1d10f60
_not_ round-trip tests for fetchers::PublicKey default type (#10637)
Another continuation of #10602
2024-05-06 09:50:26 -04:00
Eelco Dolstra
20558e0462 Remove FSInputAccessor 2024-05-03 12:30:28 +02:00
Eelco Dolstra
ba5929c7be Merge InputAccessor into SourceAccessor
After the removal of the InputAccessor::fetchToStore() method, the
only remaining functionality in InputAccessor was `fingerprint` and
`getLastModified()`, and there is no reason to keep those in a
separate class.
2024-05-03 12:14:01 +02:00
Robert Hensing
e17aad23d6
Merge pull request #10555 from jlesquembre/jl/c-api_check-init
Add isValid to nix::Value
2024-05-01 16:33:01 +02:00
Eelco Dolstra
1f41682217
Update tests/functional/flakes/flakes.sh
Co-authored-by: John Ericson <git@JohnEricson.me>
2024-04-30 18:10:16 +02:00
Eelco Dolstra
f29a220b70 Test that the root of a tree produces /nix/store/<hash1>-<hash2>-source 2024-04-30 17:25:35 +02:00
Eelco Dolstra
503be57bbd Test baseNameOf behaviour on the root of a flake 2024-04-30 15:43:33 +02:00
Eelco Dolstra
458441c637 Test dirOf behaviour on the root of a flake 2024-04-30 15:34:38 +02:00
John Ericson
4722b0c9e9
Merge pull request #10602 from haenoe/json-infra-tests-misc
Json infra tests misc
2024-04-25 16:53:51 -04:00
HaeNoe
c73172e986
add unit tests for getNullable 2024-04-24 18:22:53 +02:00
HaeNoe
4ff7f5aa9c
refactor fetchers::PublicKey tests 2024-04-24 18:22:41 +02:00
Max
5ecd820c18 Merge remote-tracking branch 'nixos/master' 2024-04-22 23:29:11 +02:00
Robert Hensing
750bcaa330 Fix fetchGit nested submodules 2024-04-22 16:41:40 +02:00
José Luis Lafuente
6acf02b32a
C API: source argument to nix_copy_value should be const 2024-04-21 22:46:18 +02:00
José Luis Lafuente
8d70db3251
C API: add check_value_[in,out] helper functions 2024-04-21 22:44:14 +02:00
José Luis Lafuente
ff76dd2211
C API: fix test, nix float is a double internally 2024-04-21 22:44:14 +02:00
José Luis Lafuente
ccad6e94e2
C API: add (un)initialized value checks 2024-04-21 22:44:14 +02:00
José Luis Lafuente
9d7dee4a8f
nix::Value: Use more descriptive names 2024-04-21 22:44:13 +02:00
José Luis Lafuente
5cc4af5231
Add isInitialized to nix::Value
Add a method to check if a value has been initialized. This helps avoid
segfaults when calling `type()`.
Useful in the context of the new C API.

Closes #10524
2024-04-21 22:44:13 +02:00
Robert Hensing
6fd2f42c2d
Merge pull request #10573 from RCoeurjoly/Rename_SearchPath
Rename SearchPath to LookupPath and searchPath to lookupPath
2024-04-21 17:33:46 +02:00
Robert Hensing
1b6cd1d2af Revert "tests/test-libstoreconsumer: Ignore config"
This reverts commit 62feb5ca09263c78ddb692836228223e5b58d3ae.

It runs as part of the functional tests, which control the environment,
solving some of the problems a default config has when run in the
sandbox.
2024-04-20 01:45:04 +02:00
Robert Hensing
bcaa2e4a85 tests/libstore-support: Ignore config 2024-04-20 01:45:04 +02:00
Robert Hensing
0ecf7dac3b tests/test-libstoreconsumer: Ignore config 2024-04-20 01:45:04 +02:00
Max
2d0b0537fe Merge remote-tracking branch 'nixos/master' 2024-04-19 16:42:33 +02:00
Robert Hensing
538eb2617a
Merge pull request #10537 from hercules-ci/c-api-nix-value-init-apply
C API: Add nix_init_apply
2024-04-18 20:09:24 +02:00
Robert Hensing
ad643cde58 C API: Add nix_init_apply
Thunks are relevant when initializing attrsets and lists, passing
arguments. This is an important way to produce them.
2024-04-18 19:13:38 +02:00
John Ericson
8433027e35 Build a minimized Nix with MinGW
At this point many features are stripped out, but this works:

- Can run libnix{util,store,expr} unit tests
- Can run some Nix commands

Co-Authored-By volth <volth@volth.com>
Co-Authored-By Brian McKenna <brian@brianmckenna.org>
2024-04-17 12:26:10 -04:00
Eelco Dolstra
6a3ecdaa39 Merge remote-tracking branch 'origin/master' into finish-value 2024-04-17 16:02:44 +02:00
José Luis Lafuente
c75b143b6c
C API: nix_get_string now accepts a callback to return the value 2024-04-16 22:36:39 +02:00
Eelco Dolstra
74e4bc9b1d
Merge pull request #10486 from tweag/jl/c-api_function-pointer
C API: Safer function pointer casting
2024-04-16 18:56:08 +02:00
Théophane Hufschmitt
d2a07a96ba
Merge pull request #10467 from edolstra/nix-shell-symlink
nix shell: Handle output paths that are symlinks
2024-04-16 12:31:14 +02:00
John Ericson
65cc237b3a
Merge pull request #10482 from tweag/fix-symlink-in-sandbox
Fix the access of symlinks to host files in the sandbox
2024-04-15 09:29:00 -04:00
Eelco Dolstra
d084c1cb41 Remove the "locked" flag from the fetcher cache
This also reworks the Mercurial fetcher (which was still using the
old cache interface) to have two distinct cache mappings:

* A ref-to-rev mapping, which is store-independent.
* A rev-to-store-path mapping.
2024-04-15 13:03:27 +02:00
José Luis Lafuente
774e7213e8
C API: Use nix_get_string_callback typedef 2024-04-15 12:05:57 +02:00
HaeNoe
ff4c286e80
add tests for optionalValueAt 2024-04-14 22:36:03 +02:00
Roland Coeurjoly
40a6a9fdb8 Rename SearchPath to LookupPath and searchPath to lookupPath 2024-04-13 17:35:15 +02:00
José Luis Lafuente
01bad63c72
C API: Safer function pointer casting
See https://github.com/NixOS/nix/pull/8699#discussion_r1554312181

Casting a function pointer to `void*` is undefined behavior in the C
spec, since there are platforms with different sizes for these two kinds
of pointers. A safe alternative might be `void (*callback)()`
2024-04-12 21:41:15 +02:00
Théophane Hufschmitt
cef677ddbc Test the inclusion of transitive symlinks in the sandbox 2024-04-12 16:10:22 +02:00
Théophane Hufschmitt
acbb1523c1 Fix the access of symlinks to host files in the sandbox
https://github.com/NixOS/nix/pull/10456 fixed the addition of symlink
store paths to the sandbox, but also made it so that the hardcoded
sandbox paths (like `/etc/hosts`) were now bind-mounted without
following the possible symlinks. This made these files unreadable if
there were symlinks (because the sandbox would now contain a symlink to
an unreachable file rather than the underlying file).
In particular, this broke FOD derivations on NixOS as `/etc/hosts` is a
symlink there.

Fix that by canonicalizing all these hardcoded sandbox paths before
adding them to the sandbox.
2024-04-12 15:57:53 +02:00
John Ericson
5b9cb8b372
Merge pull request #10412 from roberth/c-string-context
C API: Add `nix_string_realise`
2024-04-11 12:07:31 -04:00
Robert Hensing
f2522d4ecd libexpr-c: Add nix_store_path_name 2024-04-11 17:39:21 +02:00
Robert Hensing
a512f4eebc test/libutil: Add OBSERVE_STRING macro
Makes string callback easier to pass, without mistakes.
2024-04-11 17:39:21 +02:00
Robert Hensing
876e70bc9a tests/unit/libexpr/local.mk
A proper build system would catch errors like this.
2024-04-11 17:39:21 +02:00
Robert Hensing
48808a5320 tests/unit/libexpr: Enable nix_store_realise test, and add docs 2024-04-11 17:39:21 +02:00
Robert Hensing
94d9819bdc tests/unit/libexpr/main: Fix realisation 2024-04-11 17:39:19 +02:00
Bouke van der Bijl
1e4f902b28 Add gitSubmodules test to github actions 2024-04-11 15:55:09 +02:00
Bouke van der Bijl
cd06193d13 Add nixos test 2024-04-11 15:28:38 +02:00
Théophane Hufschmitt
da1e977bf4
Merge pull request #10456 from NixOS/fixpermdeniedbind
Fix adding symlink to the sandbox paths
2024-04-11 13:41:49 +02:00
Eelco Dolstra
26a4688a86 nix shell: Test that store paths cannot link outside of the store 2024-04-11 11:06:35 +02:00
Eelco Dolstra
9d50f57fa3 Doh 2024-04-11 09:00:47 +02:00
Théophane Hufschmitt
def00d7b52
Merge pull request #10455 from tie/structured-attrs-get-env
Do not rely on $stdenv/setup to set output variables
2024-04-11 06:48:36 +02:00
Eelco Dolstra
85b9f4ef4f nix shell: Handle output paths that are symlinks
This requires moving resolveSymlinks() into SourceAccessor. Also, it
requires LocalStoreAccessor::maybeLstat() to work on parents of the
store (to avoid an error like "/nix is not in the store").

Fixes #10375.
2024-04-10 23:49:19 +02:00
Ivan Trubach
664532c533 Do not rely on $stdenv/setup to set output variables
Instead of relying on setup script to set output variables when
structured attributes are enabled, iterate over the values of an
outputs associative array.

See also
374fa3532e/pkgs/stdenv/generic/setup.sh (L23-L26)
2024-04-10 19:50:19 +03:00
Théophane Hufschmitt
a268c0de71
Merge pull request #10413 from Ma27/path-info-all-binary-cache
path-info: print correct path when using `nix path-info --store file://... --all --json`
2024-04-10 15:25:50 +02:00
Théophane Hufschmitt
872d93eb13 Add a test for depending on a symlink store path
Regression test for https://github.com/NixOS/nix/issues/9579
2024-04-10 15:17:39 +02:00
John Ericson
93d68e18e5 Make outputHashAlgo accept "nar", stay in sync
Now that we have a few things identifying content address methods by
name, we should be consistent about it.

Move up the `parseHashAlgoOpt` for tidiness too.

Discussed this change for consistency's sake as part of #8876

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-04-09 16:17:23 -04:00
Eelco Dolstra
737ce5e81f Actually run the Mercurial tests 2024-04-08 15:21:57 +02:00
Théophane Hufschmitt
bd8c276ddb Improve the config check output for stores that don't know about trust
Make it proper english
2024-04-08 11:02:39 +02:00
Jade Lovelace
dea23c3c9b "but doctor, I AM the untrusted store": nix doctor had wrong trustedness
This probably snuck in in a refactor using truthiness or so. The
trustedness flag was having the optional fullness checked, rather than
the actual contained trust level.

Also adds some tests.

```
m1@6876551b-255d-4cb0-af02-8a4f17b27e2e ~ % nix store ping
warning: 'nix store ping' is a deprecated alias for 'nix store info'
Store URL: daemon
Version: 2.20.4
Trusted: 0
m1@6876551b-255d-4cb0-af02-8a4f17b27e2e ~ % nix doctor
warning: 'doctor' is a deprecated alias for 'config check'
[PASS] PATH contains only one nix version.
[PASS] All profiles are gcroots.
[PASS] Client protocol matches store protocol.
[INFO] You are trusted by store uri: daemon
```
2024-04-07 22:43:02 -07:00
John Ericson
bd7c26bc7b Add comment explaining LIBMOUNT_FORCE_MOUNT2=always 2024-04-07 21:55:19 -04:00
cidkidnix
e73dc0e938 Use LIBMOUNT_FORCE_MOUNT2=always to workaround new mount API issues 2024-04-05 16:43:14 -05:00
Max
05c190487d Merge remote-tracking branch 'nixos/master' 2024-04-05 22:42:41 +02:00
John Ericson
c99c80f075 Merge remote-tracking branch 'upstream/master' into overlayfs-store 2024-04-05 16:32:02 -04:00
Maximilian Bosch
c80cd6bb06
path-info: print correct path when using nix path-info --store file://... --all --json
When querying all paths in a binary cache store, the path's representation
is `<hash>-x` (where `x` is the value of `MissingName`) because the .narinfo
filenames only contain the hash.

Before cc46ea1630 this worked correctly,
because the entire path info was read and the path from this
representation was printed, i.e. in the form `<hash>-<name>`. Since then
however, the direct result from `queryAllValidPaths()` was used as `path`.

Added a regression test to make sure the behavior remains correct.
2024-04-05 21:29:55 +02:00
Robert Hensing
02c41aba5b libexpr-c: Add nix_string_realise 2024-04-05 16:08:18 +02:00
John Ericson
c1e0769355 Fix some portability issues with the new C bindings
Build without GC is unbroken

Fix #10403

Also building tests with Windows (assuming rest of Windows fixes) is
unbroken.
2024-04-05 00:54:47 -04:00
John Ericson
ef2d10f7e7 Clean up env var logic in preparation for Windows
It's a little weird we don't check the return status for these, but
changing that would introduce risk so I did not.

Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-04-04 18:17:12 -04:00
Robert Hensing
12ec3154b8
Merge pull request #8699 from tweag/nix-c-bindings
(Towards) stable C bindings for libutil, libexpr
2024-04-04 17:50:52 +02:00
HaeNoe
50cb14fcf9
Improve checked json casting (#10087)
This introduces new utility functions to get elements from JSON — in an ergonomic way and with nice error messages if the expected type does not match.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2024-04-03 18:04:00 +00:00
Eelco Dolstra
bf86b939f8
Merge pull request #10391 from edolstra/home-symlink
Handle the case where a parent of ~/.nix-defexpr is a symlink
2024-04-03 17:20:35 +02:00
John Ericson
36d92dc80a
Merge pull request #10316 from dottharun/derivation-output-test
test: for derivation output selection with `.`
2024-04-03 10:48:04 -04:00
Eelco Dolstra
09551fabd0 Handle the case where a parent of ~/.nix-defexpr is a symlink
Fixes https://github.com/DeterminateSystems/nix-installer/issues/912 and probably #10247.
2024-04-03 16:46:23 +02:00
Tharun T
8d84de455e outputSpecified doesnt exit in top attr-set 2024-04-03 08:26:42 +05:30
Cameron Dart
ba0bd8fae6 Add functional tests for include directive in nix config file 2024-04-02 18:10:36 -07:00
Théophane Hufschmitt
290be6c906
Merge pull request #10345 from edolstra/fix-chroot-flakes
Fix flake evaluation in chroot stores
2024-04-02 17:49:45 +02:00
Théophane Hufschmitt
29c3e4f580
Merge pull request #10340 from edolstra/trust-github
Add trust-tarballs-from-git-forges setting
2024-04-02 16:08:57 +02:00
Sergei Zimmerman
a66b5a1526
test(nixos): add integration test for doubly-compressed content
Add an integration test with a compressing proxy (nginx is used).
This test verifies that fetched archives do not get decompressed
excessively.
2024-03-30 01:29:34 +03:00
Théophane Hufschmitt
b72e1c79da
Merge pull request #10299 from detroyejr/remove-repl-flake
flakes: remove experimental repl-flake
2024-03-29 15:06:23 +01:00
José Luis Lafuente
926fbadcc3
C API: add more tests 2024-03-29 14:00:19 +01:00
Eelco Dolstra
00ce36fafe Add test 2024-03-29 13:38:55 +01:00
Eelco Dolstra
8930772864 Add regression test for #10331, #10267 2024-03-29 13:20:50 +01:00
Eelco Dolstra
dffc22f30f Rename local-store.sh -> chroot-store.sh 2024-03-29 12:51:14 +01:00
Théophane Hufschmitt
de101417eb
Merge pull request #10305 from hercules-ci/addErrorContext-is-great
Always print addErrorContext
2024-03-29 09:10:09 +01:00
Robert Hensing
ef26133df3
Merge pull request #10337 from Cyclic4179/patch-1
`nix shell` shebang: support O'Caml comments
2024-03-28 19:54:03 +01:00
José Luis Lafuente
061140fc8f
C API: remove unused argument 2024-03-28 19:38:12 +01:00
José Luis Lafuente
925a8fda6e
C API: Use new ListBuilder helper
See https://github.com/NixOS/nix/pull/10251
2024-03-28 19:02:01 +01:00
José Luis Lafuente
c57de60522
C API: Keep the structure flat
See https://github.com/NixOS/nix/pull/10329
2024-03-28 19:00:04 +01:00
José Luis Lafuente
d96b52bd8b
C api: nix_export_std_string -> nix_observe_string 2024-03-28 10:52:02 +01:00
José Luis Lafuente
940ff6535c
C API: update libstore tests 2024-03-28 10:52:02 +01:00
José Luis Lafuente
1a574c6c60
C API: refactor ListBuilder 2024-03-28 10:52:01 +01:00
José Luis Lafuente
34d15e8f2f
C API: rename nix_store_build -> nix_store_realise 2024-03-28 10:52:01 +01:00
José Luis Lafuente
1093ab64a2
C API: add more tests 2024-03-28 10:52:01 +01:00
José Luis Lafuente
2e1dbbe307
C API: refactor test support 2024-03-28 10:52:01 +01:00
José Luis Lafuente
c49b88b066
C API: update docs based on PR feedback 2024-03-28 10:52:01 +01:00
José Luis Lafuente
7c602d9f01
C API: add tests for external values 2024-03-28 10:52:01 +01:00
José Luis Lafuente
6c231dcf68
C API: disable test 2024-03-28 10:52:00 +01:00
José Luis Lafuente
b9cd24a4a8
C API: fix api_expr tests 2024-03-28 10:52:00 +01:00
José Luis Lafuente
24c8f6864d
C API: if store doesn't have a version, return an empty string 2024-03-28 10:52:00 +01:00
José Luis Lafuente
dfdb90dc8e
C API: Consolidate initializers 2024-03-28 10:52:00 +01:00
José Luis Lafuente
51ff547d9a
C API: add more tests to nix_api_expr 2024-03-28 10:52:00 +01:00
José Luis Lafuente
d5ec1d0617
C API: nix_store_open, check for empty strings 2024-03-28 10:51:59 +01:00
José Luis Lafuente
535694122e
C API: rename State to EvalState 2024-03-28 10:51:59 +01:00
José Luis Lafuente
ac3a9c6605
C API: add nix_api_expr tests 2024-03-28 10:51:48 +01:00
José Luis Lafuente
41f1669dea
C API: add tests for libutil and libstore 2024-03-28 10:50:02 +01:00
Yorick van Pelt
e642bbc2a7
C API: move to src/lib*/c/ 2024-03-28 10:46:39 +01:00
Yorick van Pelt
c48b9b8a83
nix_api_util: tests 2024-03-28 10:39:07 +01:00
Tharun T
52359ca00a move test to correct file 2024-03-28 02:20:33 +05:30
John Ericson
77205b2042 Allow for ergnomically putting Unix-only files in subdirs by creating INLCUDE_$(pkg) vars
Separate platform-specific files will allow avoiding a lot of CPP.
2024-03-27 12:01:59 -04:00
Robert Hensing
981c309057 Remove trace item: while calling the 'addErrorContext' builtin 2024-03-27 16:28:04 +01:00
Robert Hensing
bebacc475c Always print addErrorContext traces 2024-03-27 16:28:04 +01:00
Cyclic4179
9f7b2b93ce
fixup! add flakes.sh test for shebang supported types of comments 2024-03-27 15:03:54 +01:00
Cyclic4179
6227cd06bd
add flakes.sh test for shebang supported types of comments 2024-03-27 14:55:02 +01:00
Théophane Hufschmitt
6c10cc0eda
Merge pull request #10312 from hercules-ci/add-build-dir
Add build-dir setting
2024-03-26 13:51:50 +01:00
Théophane Hufschmitt
1394d4e9c5
Merge pull request #10306 from hercules-ci/baseNameOf
Test and document `builtins.baseNameOf`, improve internal `baseNameOf()`
2024-03-26 09:59:27 +01:00
Robert Hensing
8b16cced18 Add build-dir setting 2024-03-25 19:48:59 +01:00
Robert Hensing
6221770c9d tests/functional: Add count() 2024-03-25 19:46:34 +01:00
Eelco Dolstra
8c0590fa32 Never update values after setting the type
Thunks are now overwritten by a helper function
`Value::finishValue(newType, payload)` (where `payload` is the
original anonymous union inside `Value`). This helps to ensure we
never update a value elsewhere, since that would be incompatible with
parallel evaluation (i.e. after a value has transitioned from being a
thunk to being a non-thunk, it should be immutable).

There were two places where this happened: `Value::mkString()` and
`ExprAttrs::eval()`.

This PR also adds a bunch of accessor functions for value contents,
like `Value::integer()` to access the integer field in the union.
2024-03-25 19:21:25 +01:00
Max
06eac000db fix search test 2024-03-25 18:46:03 +01:00
Max
ee50c7d033 adjust test output for eval-fail-function-apply-dollar 2024-03-25 18:33:38 +01:00
Max
fd78c9b000 Merge remote-tracking branch 'nixos/master' 2024-03-25 17:43:50 +01:00
Tharun T
53c15336b0 derivation output selection test 2024-03-25 07:43:31 +05:30
John Ericson
2a44b11f55 Fix git-hashing/simple.sh
I realized it was checking NAR hashes before of added objects, which
makes little sense --- we don't really care about ancillary NAR hashes.

Now, the bottom `nix store add` tests compare the CA field with a git
hash to hashes calculated by Git. This matches top `nix hash path` ones
in using git as a source of truth.
2024-03-23 22:08:52 -04:00
Robert Hensing
9884018dfa baseNameOf(): Remove all trailing slashes 2024-03-24 01:38:22 +01:00
Robert Hensing
175afc7106 Test and document builtins.baseNameOf 2024-03-24 01:26:17 +01:00
detroyejr
b11dd58fe4 flakes: test to ensure we get an error if --file isn't used 2024-03-22 21:58:39 -04:00
Robert Hensing
d16d7f5f31
Merge pull request #10251 from edolstra/list-builder
Add a ListBuilder helper for constructing list values
2024-03-20 22:30:38 +01:00
John Ericson
18945e3f44 Merge branch 'master' into overlayfs-store 2024-03-18 16:43:33 -04:00
Eelco Dolstra
fecff520d7 Add a ListBuilder helper for constructing list values
Previously, `state.mkList()` would set the type of the value to tList
and allocate the list vector, but it would not initialize the values
in the list. This has two problems:

* If an exception occurs, the list is left in an undefined state.

* More importantly, for multithreaded evaluation, if a value
  transitions from thunk to non-thunk, it should be final (i.e. other
  threads should be able to access the value safely).

To address this, there now is a `ListBuilder` class (analogous to
`BindingsBuilder`) to build the list vector prior to the call to
`Value::mkList()`. Typical usage:

   auto list = state.buildList(size);
   for (auto & v : list)
       v = ... set value ...;
   vRes.mkList(list);
2024-03-15 18:26:37 +01:00
Bouke van der Bijl
60c2d15f5a git fetcher: use resolveRef for getting revision of reference
* Add regression test
* Fix 'no repo' test so it doesn't succeed if the data is still in cache
* Use git_revparse_single inside git-utils instead of reimplementing the same logic.
2024-03-14 14:04:51 +01:00
Eelco Dolstra
c1811c1eba Fix GitHub test
Cherry-picked from 03618bb85f609a9b2f3cd6b82628a95b425e3b72.
2024-03-10 13:38:38 +01:00
tomberek
a200ee6bf7
Merge pull request #9874 from pennae/error-reports
improve error reports somewhat
2024-03-08 10:51:14 -05:00
Eelco Dolstra
ae2bd460a8
Merge pull request #10166 from bobvanderlinden/profile-regex-all
profile: introduce --regex and --all
2024-03-08 15:59:24 +01:00
Bob van der Linden
91f068c193
profile: make --all exclusive 2024-03-07 21:07:03 +01:00
Bob van der Linden
7a4d5e89d3
profile: add --all option to match any package 2024-03-07 21:07:03 +01:00
Bob van der Linden
fb391ebc77
profile: add tests for not matching any packages 2024-03-07 21:07:03 +01:00
Bob van der Linden
9fac62435c
tests/functional: add assertStderr function
Currently there isn't a convenient way to check for multiline output. In
addition, these outputs will easily change and having a diff between the
expected an the actual output upon failures is convenient.
2024-03-07 21:07:03 +01:00
Bob van der Linden
87741dbd21
profile: add --regex option to match packages 2024-03-07 21:07:03 +01:00
Eelco Dolstra
da62528487
Merge pull request from GHSA-2ffj-w4mj-pg37
Copy built outputs
2024-03-07 11:56:24 +01:00
Robert Hensing
73cf23275e
Merge pull request #10107 from tweag/repl-file-argument
Properly fail on flakerefs that don't point to a directory
2024-03-07 10:04:35 +01:00
pennae
5d9fdab3de use byte indexed locations for PosIdx
we now keep not a table of all positions, but a table of all origins and
their sizes. position indices are now direct pointers into the virtual
concatenation of all parsed contents. this slightly reduces memory usage
and time spent in the parser, at the cost of not being able to report
positions if the total input size exceeds 4GiB. this limit is not unique
to nix though, rustc and clang also limit their input to 4GiB (although
at least clang refuses to process inputs that are larger, we will not).

this new 4GiB limit probably will not cause any problems for quite a
while, all of nixpkgs together is less than 100MiB in size and already
needs over 700MiB of memory and multiple seconds just to parse. 4GiB
worth of input will easily take multiple minutes and over 30GiB of
memory without even evaluating anything. if problems *do* arise we can
probably recover the old table-based system by adding some tracking to
Pos::Origin (or increasing the size of PosIdx outright), but for time
being this looks like more complexity than it's worth.

since we now need to read the entire input again to determine the
line/column of a position we'll make unsafeGetAttrPos slightly lazy:
mostly the set it returns is only used to determine the file of origin
of an attribute, not its exact location. the thunks do not add
measurable runtime overhead.

notably this change is necessary to allow changing the parser since
apparently nothing supports nix's very idiosyncratic line ending choice
of "anything goes", making it very hard to calculate line/column
positions in the parser (while byte offsets are very easy).
2024-03-06 23:48:42 +01:00
pennae
855fd5a1bb diagnose "unexpected EOF" at EOF
this needs a string comparison because there seems to be no other way to
get that information out of bison. usually the location info is going to
be correct (pointing at a bad token), but since EOF isn't a token as
such it'll be wrong in that this case.

this hasn't shown up much so far because a single line ending *is* a
token, so any file formatted in the usual manner (ie, ending in a line
ending) would have its EOF position reported correctly.
2024-03-06 23:11:12 +01:00
pennae
2be6b14328 match line endings used by parser and error reports
the parser treats a plain \r as a newline, error reports do not. this
can lead to interesting divergences if anything makes use of this
feature, with error reports pointing to wrong locations in the input (or
even outside the input altogether).
2024-03-06 23:11:12 +01:00
pennae
1edd6fada5 report inherit attr errors at the duplicate name
previously we reported the error at the beginning of the binding
block (for plain inherits) or the beginning of the attr list (for
inherit-from), effectively hiding where exactly the error happened.

this also carries over to runtime positions of attributes in sets as
reported by unsafeGetAttrPos. we're not worried about this changing
observable eval behavior because it *is* marked unsafe, and the new
behavior is much more useful.
2024-03-06 23:11:12 +01:00
pennae
4147ecfb1c normalize formal order on ExprLambda::show
we already normalize attr order to lexicographic, doing the same for
formals makes sense. doubly so because the order of formals would
otherwise depend on the context of the expression, which is not quite as
useful as one might expect.
2024-03-06 23:11:12 +01:00
pennae
d384ecd553 keep copies of parser inputs that are in-memory only
the parser modifies its inputs, which means that sharing them between
the error context reporting system and the parser itself can confuse the
reporting system. usually this led to early truncation of error context
reports which, while not dangerous, can be quite confusing.
2024-03-06 23:11:12 +01:00
Eelco Dolstra
6b976a1898
Merge pull request #10143 from fricklerhandwerk/test-help
add tests for showing help
2024-03-04 20:29:03 +01:00
Valentin Gagarin
8d23847571
fix indentation
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-04 19:25:44 +01:00
Valentin Gagarin
8a6ef3bae5
less scary jq
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-04 19:25:28 +01:00
Valentin Gagarin
4b15ca2ffb add tests for showing help 2024-03-04 16:14:00 +01:00
Eelco Dolstra
438855952b
Merge pull request #10122 from edolstra/arg-from-file
Add --arg-from-file and --arg-from-stdin
2024-03-04 13:29:58 +01:00
Théophane Hufschmitt
8a9eec375c
Merge pull request #10073 from olmokramer/nix-flake-update-multiple-inputs
Accept multiple inputs in `nix flake update`
2024-03-04 09:13:26 +01:00
Olmo Kramer
b1ad729add
Add test for nix flake update with multiple inputs 2024-03-03 13:59:39 +01:00
Jade Lovelace
2625e9fb0a Ban building Nix with NDEBUG
When reviewing old PRs, I found that #9997 adds some code to ensure one
particular assert is always present. But, removing asserts isn't
something we do in our own release builds either in the flake here or in
nixpkgs, and is plainly a bad idea that increases support burden,
especially if other distros make bad choices of build flags in their Nix
packaging.

For context, the assert macro in the C standard is defined to do nothing
if NDEBUG is set.

There is no way in our build system to set -DNDEBUG without manually
adding it to CFLAGS, so this is simply a configuration we do not use.
Let's ban it at compile time.

I put this preprocessor directive in src/libutil.cc because it is not
obvious where else to put it, and it seems like the most logical file
since you are not getting a usable nix without it.
2024-03-02 11:22:46 -08:00