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

2316 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
Solène Rapenne
d0660c6c0b
printMsg replacement by printInfo
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2022-12-16 09:34:22 +01:00
Solène Rapenne
98e01da0b1 warnings: switch to info level when using a saved substituter 2022-12-14 14:11:21 +01:00
Eelco Dolstra
8becbb063a Merge remote-tracking branch 'origin/master' into lazy-trees 2022-12-14 14:02:36 +01:00
Eelco Dolstra
d8620d7797 Append a slash in ./${"foo"} 2022-12-14 13:47:47 +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
c9b0a85b08 Restore display of source lines for stdin/string inputs 2022-12-13 16:00:44 +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
877ea1dab8
Use get_ptr()
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2022-12-12 12:46:13 +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
d950e3a0db Improve error message when flake.nix exists but is not under Git control 2022-12-09 17:53:44 +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
Eelco Dolstra
116acc108e Fix readDir for accessors whose readDirectory doesn't return types 2022-12-02 16:46:54 +01:00
Eelco Dolstra
3a8341f57e
Merge pull request #7395 from obsidiansystems/evaluating-to-calling
Change "while evaluating <fun>" to "while *calling*" in trace
2022-12-02 15:53:57 +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
Alex Ameen
ef524013aa doc: listToAttrs: add extra whitespace 2022-12-01 10:32:45 -06:00
Eelco Dolstra
39a783ffff Require flakes for the -I flake:... feature 2022-12-01 16:59:18 +01:00
Alex Ameen
ec18b7d09b doc: listToAttrs: fix line wrapping 2022-11-30 23:21:09 -06:00
Alex Ameen
ad46726546 doc: listToAttrs: document repeated keys 2022-11-30 22:53:41 -06: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
Eelco Dolstra
515b908690 Fix decoding virtual paths that are at the root of the tree 2022-11-25 17:50:44 +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
Eelco Dolstra
64a69b4054 Fix dirOf on the root of a flake 2022-11-16 14:21:07 +01:00
Théophane Hufschmitt
8b4352d79b Merge remote-tracking branch 'nixos/master' into readFile-scan-references 2022-11-14 15:00:05 +01:00
Naïm Favier
e7ed9ae0c7
Restrict readFile context to references that appear in the string
When calling `builtins.readFile` on a store path, the references of that
path are currently added to the resulting string's context.

This change makes those references the *possible* context of the string,
but filters them to keep only the references whose hash actually appears
in the string, similarly to what is done for determining the runtime
references of a path.
2022-11-11 13:04:34 +01:00
Théophane Hufschmitt
9550b1d519
Merge pull request #7258 from ncfavier/fix-eval-error-fmt
Fix printing of eval errors with two format placeholders
2022-11-10 18:41:16 +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
b275aa4475 Don't use warnOnce() for the toString warning 2022-10-28 16:34:02 +02:00
Eelco Dolstra
f02da621ed builtins.trace: Decode virtual paths 2022-10-28 16:25:47 +02: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
16838726a2 Use __nix_virtual__ instead of __virtual__
As suggested by @Ma27.
2022-10-26 16:38:45 +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
e2353b9b45 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-10-26 16:30:23 +02:00
Eelco Dolstra
da2c61637b
Use _type
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2022-10-25 16:48:31 +02:00
Shea Levy
334fa81d08
Mark flakes with .type = "flake".
Fixes #7186
2022-10-23 06:54:11 -04:00
Eelco Dolstra
f3193edd87
Merge pull request #7149 from amjoseph-nixpkgs/pr/intersectAttrs/values
parseDrvName: remove doc/impl discrepancy, add test covering the gap
2022-10-12 10:00:39 +02:00
Eelco Dolstra
511590976c Fix handling of relative paths
In particular, 'path:..' got turned into 'path:.' because isRelative()
returned a CanonPath, which cannot represent '..'.

Reported by @erikarvstedt.
2022-10-10 18:56:19 +02:00