1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00
Commit graph

740 commits

Author SHA1 Message Date
Eelco Dolstra
15d2e0e63b Merge remote-tracking branch 'origin/master' into tmp 2022-12-20 13:50:16 +01:00
Eelco Dolstra
8332ac6a1d
Merge pull request #7451 from edolstra/abstract-pos
Introduce AbstractPos
2022-12-20 12:55:13 +01:00
Eelco Dolstra
8becbb063a Merge remote-tracking branch 'origin/master' into lazy-trees 2022-12-14 14:02:36 +01:00
Eelco Dolstra
a322306247 For backward compatibility, allow appending non-root paths to the root FS
This makes

  let foo = "foo"; in /${foo}

work again.
2022-12-14 13:21:54 +01:00
Eelco Dolstra
aea97f07a3 Fix compilation 2022-12-13 15:23:12 +01:00
Eelco Dolstra
1315133b50
Improve cast safety
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2022-12-13 12:38:33 +01:00
Théophane Hufschmitt
6e31d27cba
Merge pull request #6741 from Mindavi/nix-no-gc
support building with --enable-gc=no
2022-12-13 10:36:59 +01:00
Eelco Dolstra
b3fdab28a2 Introduce AbstractPos
This makes the position object used in exceptions abstract, with a
method getSource() to get the source code of the file in which the
error originated. This is needed for lazy trees because source files
don't necessarily exist in the filesystem, and we don't want to make
libutil depend on the InputAccessor type in libfetcher.
2022-12-13 00:50:43 +01:00
Rick van Schijndel
672ee88231 support building with --enable-gc=no
Some minor changes fixing the build without boehm.
Fixes NixOS#6250
2022-12-12 23:31:30 +01:00
John Ericson
7b122d43a4 Fix stack context notes to not rely on order
Make everything be in the form "while ..." (most things were already),
and in particular *don't* use other propositions that must go after or
before specific "while ..." clauses to make sense.
2022-12-12 18:41:00 +00:00
Eelco Dolstra
12c554acd4 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-12-12 17:53:06 +01:00
Eelco Dolstra
fd0ed75118 Support flake references in the old CLI
Fixes #7026.
2022-12-12 14:05:52 +01:00
Eelco Dolstra
ae5f62a894 Move isUri() and resolveUri() out of filetransfer.cc
These are purely related to NIX_PATH / -I command line parsing, so put
them in libexpr.
2022-12-12 14:05:35 +01:00
Eelco Dolstra
f3d1e92856
Update URL
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2022-12-12 12:37:55 +01:00
Eelco Dolstra
6d104bbbac Don't allow appending a non-absolute path to the root of a source tree
This avoids an inconsistency where a '/' is implicitly inserted when
you append to the root of a source tree, but not when you append to
any other path.
2022-12-08 16:39:27 +01:00
Eelco Dolstra
703d863a48 Trivial changes from the lazy-trees branch 2022-12-07 14:06:34 +01:00
Eelco Dolstra
fcdca3d776 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-12-05 13:05:18 +01:00
John Ericson
19c5394971 Change "while evaluating <fun>" to "while *calling*" in trace
The old way was not correct.

Here is an example:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x 1' --show-trace
error: asdf

       … while evaluating 'x'

       at «string»:1:9:

            1| let x = a: throw "asdf"; in x 1
             |         ^

       … from call site

       at «string»:1:29:

            1| let x = a: throw "asdf"; in x 1
             |                             ^
```
and yet also:
```
 $ nix-instantiate --eval --expr 'let x = a: throw "asdf"; in x' --show-trace
<LAMBDA>
```

Here is the thing: in both cases we are evaluating `x`!

Nix is a higher-order languages, and functions are a sort of value. When
we write `x = a: ...`, `a: ...` is the expression that `x` is being
defined to be, and that is already a value. Therefore, we should *never*
get an trace that says "while evaluating `x`", because evaluating `a:
...` is *trival* and nothing happens during it!

What is actually happening here is we are applying `x` and evaluating
its *body* with arguments substituted for parameters. I think the
simplest way to say is just "while *calling* `x`", and so that is what I
changed it to.
2022-12-02 09:14:12 -05:00
Eelco Dolstra
dbf78a7ada
Merge pull request #7313 from yorickvP/nlohmann-everywhere
Replace src/libutil/json.cc with nlohmann
2022-11-28 15:03:48 +01:00
Eelco Dolstra
0b4c4d7434 Don't use GC_STRNDUP
It calls strlen() on the input (rather than simply copying at most
`size` bytes), which can fail if the input is not zero-terminated and
is inefficient in any case.

Fixes #7347.
2022-11-25 22:30:56 +01:00
Yorick van Pelt
09f00dd4d0
Replace src/libutil/json.cc with nlohmann json generation 2022-11-16 16:50:50 +01:00
Eelco Dolstra
561440bd6d Merge remote-tracking branch 'origin/master' into lazy-trees 2022-11-16 15:07:22 +01:00
Naïm Favier
dad859ba0f
Fix printing of eval errors with two format placeholders 2022-11-04 12:41:38 +01:00
Eelco Dolstra
a653e98f55 Encode virtual paths as /nix/store/virtual000<N>
This makes lib.isStorePath in nixpkgs return true for source trees and
fixes some cases where /__nix_virtual__ showed up in the NixOS manual.
2022-10-27 15:57:56 +02:00
Eelco Dolstra
0402dd0298 Interpret absolute paths relative to the root FS rather than the current flake 2022-10-26 16:33:38 +02:00
Eelco Dolstra
c3c0682842 Don't show "from call site" when we don't know the call site
This gets rid of stack trace entries like

       … from call site

       at «stdin»:0: (source not available)
2022-09-28 17:01:16 +02:00
Eelco Dolstra
a291e37b20 Improve error messages from call-flake.nix 2022-09-28 15:09:24 +02:00
Eelco Dolstra
2a1c63c785 Support flake references in the old CLI
Fixes #7026.
2022-09-13 19:05:05 +02:00
Eelco Dolstra
432a3a18d2 Move isUri() and resolveUri() out of filetransfer.cc
These are purely related to NIX_PATH / -I command line parsing, so put
them in libexpr.
2022-09-12 15:37:09 +02:00
Eelco Dolstra
85c1959240 Remove some FIXMEs 2022-09-12 15:10:54 +02:00
Eelco Dolstra
48a5879b63 Decode virtual paths in user-thrown errors
E.g. instead of

  error: Package ‘steam’ in /__virtual__/4/pkgs/games/steam/steam.nix:43 has an unfree license (‘unfreeRedistributable’), refusing to evaluate.

you now get

  error: Package ‘steam’ in «github:nixos/nixpkgs/b82ccafb54163ab9024e893e578d840577785fea»/pkgs/games/steam/steam.nix:43 has an unfree license (‘unfreeRedistributable’), refusing to evaluate.
2022-09-12 12:52:07 +02:00
Eelco Dolstra
2d5cfca98b Fix accessing 'toString path' 2022-09-02 19:30:17 +02:00
Eelco Dolstra
2e0d63caf6 Add InputAccessor::fetchToStore() 2022-08-11 20:03:22 +02:00
Eelco Dolstra
15f37eeb5a Merge remote-tracking branch 'origin/master' into lazy-trees 2022-08-04 13:34:38 +02:00
Eelco Dolstra
ccbd906c86 Fix NIX_COUNT_CALLS=1
Also, make the JSON writer support std::string_view.

Fixes #6857.
2022-08-03 17:46:51 +02:00
Eelco Dolstra
48012603b3 Move FSInputAccessor into a separate file 2022-08-01 16:00:12 +02:00
Eelco Dolstra
bb4d35dcca Make 'nix edit' etc. work again 2022-07-26 17:06:45 +02:00
Eelco Dolstra
e17a619106 Improve display of GitHub input filenames in error messages
E.g.

  … while evaluating the attribute 'buildCommand' of the derivation 'vm-test-run-github-flakes'

  at «github:NixOS/nixpkgs/2fa57ed190fd6c7c746319444f34b5917666e5c1»/pkgs/stdenv/generic/make-derivation.nix:278:7:
2022-07-14 16:53:41 +02:00
Eelco Dolstra
9a9b03b8d6 Fix showing attributes in traces 2022-07-14 16:49:55 +02:00
Eelco Dolstra
934f317250 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-07-13 12:50:03 +02:00
Ben Burdette
a3629ab0cc move ignore-try to EvalSettings 2022-07-11 10:47:09 -06:00
Ben Burdette
69ea265fd2 'tryEval' not 'try clause' 2022-07-11 10:21:12 -06:00
Eelco Dolstra
78232889c0 Use corepkgsFS for derivation.nix 2022-07-07 14:29:58 +02:00
Eelco Dolstra
a18b3c665a Store a ref to InputAccessor in SourcePath 2022-07-06 17:25:15 +02:00
Eelco Dolstra
72dffd6c6c Connect AbstractPos with Pos 2022-07-05 20:45:29 +02:00
Eelco Dolstra
9e9170a92e Introduce AbstractPos 2022-07-05 20:45:29 +02:00
Ben Burdette
49ff4ef637 remove unused parameter 2022-06-10 12:22:36 -06:00
Ben Burdette
bc0d41e9ba print message with exceptions in a try clause 2022-06-02 12:17:28 -06:00
Ben Burdette
9151dbff88 ignore-try flag 2022-06-02 10:26:46 -06:00
Eelco Dolstra
98bdc18bf6
Merge remote-tracking branch 'origin/master' into lazy-trees 2022-05-31 15:26:03 +02:00