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

2285 commits

Author SHA1 Message Date
Eelco Dolstra
116acc108e Fix readDir for accessors whose readDirectory doesn't return types 2022-12-02 16:46:54 +01:00
Eelco Dolstra
39a783ffff Require flakes for the -I flake:... feature 2022-12-01 16:59:18 +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
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
Adam Joseph
7ef71cd21f src/libexpr/primops.cc: parseDrvName: make documentation follow implementation
The documentation for `parseDrvName` does not agree with the implementation when
the derivation name contains a dash which is followed by something that is
neither a letter nor a digit.  This commit corrects the documentation to agree
with the implementation.
2022-10-08 17:21:34 -07:00
Eelco Dolstra
241dd5481e warnOnce(): Fix boost exception when the message contains a format character 2022-09-30 15:21:43 +02:00
Eelco Dolstra
cbade16f9e Handle unlocked overriden inputs
This fixes the error

  in pure evaluation mode, 'fetchTree' requires a locked input

when using '--override-input X Y' where Y is an unlocked input (e.g. a
dirty Git tree).

Also, make LockFile use ref instead of std::shared_ptr.
2022-09-29 16:14:56 +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
28b62dd3e0 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-09-28 14:13:44 +02:00
Eelco Dolstra
6806f20157
Merge pull request #7089 from NixOS/mention-accept-flake-config-in-warning
Mention `--accept-flake-config` in the related warning
2022-09-26 11:13:02 +02:00
Adam Joseph
dc205c75a2 src/libexpr/primops.cc: correct definition for intersectAttrs
The current definition of `intersectAttrs` is incorrect:

> Return a set consisting of the attributes in the set e2 that also exist in the
> set e1.

Recall that (Nix manual, section 5.1):

> An attribute set is a collection of name-value-pairs (called attributes)

According to the existing description of `intersectAttrs`, the following should
evaluate to the empty set, since no key-value *pair* (i.e. attribute) exists in
both sets:

```
builtins.intersectAttrs { x=3; } {x="foo";}
```

And yet:

```
nix-repl> builtins.intersectAttrs { x=3; } {x="foo";}
{ x = "foo"; }
```

Clearly the intent here was for the *names* of the resulting attribute set to be
the intersection of the *names* of the two arguments, and for the values of the
resulting attribute set to be the values from the second argument.

This commit corrects the definition, making it match the implementation and intent.
2022-09-24 23:51:09 -07:00
Théophane Hufschmitt
371013c08d
Merge pull request #7010 from edolstra/ignore-shell
nix develop: Ignore stdenv's $SHELL
2022-09-24 12:55:53 +02:00
Théophane Hufschmitt
1a5d094be7
Mention --accept-flake-config in the related warning
Make sure that people who run Nix in non-interactive mode (and so don't have the possibility to interactively accept the individual flake configuration settings) are aware of this flag.

Fix #7086
2022-09-24 12:11:26 +02:00
Adam Joseph
fb985f855c fetchurl.nix: change other use of __impure 2022-09-16 01:54:24 -07:00
Adam Joseph
673fd21b7c
Update src/libexpr/fetchurl.nix
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-09-16 08:51:14 +00:00
Adam Joseph
b3550d9179 libexpr/fetchurl.nix: allow __impure fetch
This commit adds an optional `__impure` parameter to fetchurl.nix, which allows
the caller to use `libfetcher`'s fetcher in an impure derivation.  This allows
nixpkgs' patch-normalizing fetcher (fetchpatch) to be rewritten to use nix's
internal fetchurl, thereby eliminating the awkward "you can't use fetchpatch
here" banners scattered all over the place.

See also: https://github.com/NixOS/nixpkgs/pull/188587
2022-09-16 00:48:01 -07: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
1b8065f255 posToXML(): Fix displaying paths 2022-09-12 14:59:15 +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
ece12a97d9 lockfile -> lock file for consistency 2022-09-06 19:20:31 +02:00
Eelco Dolstra
2d5cfca98b Fix accessing 'toString path' 2022-09-02 19:30:17 +02:00
Eelco Dolstra
a8b3d777fb Revert "Merge pull request #6621 from Kha/nested-follows"
This reverts commit c530cda345, reversing
changes made to 4adcdff5c1.
2022-09-01 15:26:19 +02:00
Eelco Dolstra
301f388716 Remove FIXME
We don't need to return the accessor here (in fact it rarely makes
sense to return a path from the EvalCache).
2022-08-29 15:43:43 +02:00
Eelco Dolstra
7da3a30c90 Remove no_pos_tag 2022-08-29 15:43:34 +02:00
Eelco Dolstra
30be6445e6 Make EvalState::inputAccessors keyed by the accessor number 2022-08-29 15:35:35 +02:00
Sebastian Ullrich
6f65c11780 Fix overlapping flake follows 2022-08-28 11:50:25 +02:00
Sebastian Ullrich
2b9d381301 Fix nested flake input overrides 2022-08-28 11:47:25 +02:00
Eelco Dolstra
13c0db4d06 Merge remote-tracking branch 'origin/master' into lazy-trees 2022-08-25 17:41:12 +02:00
Eelco Dolstra
a17ce0a8a9 Fix evaluation cache
98e361ad4c introduced a regression where
previously stored attributes were replaced by placeholders. As a
result, a command like 'nix build nixpkgs#hello' had to be executed at
least twice to get caching.

This code does not seem necessary for suggestions to work.
2022-08-24 21:19:43 +02:00
Naïm Favier
062e4fcdde
JSON: print paths as strings without copying them to the store
Makes `printValueAsJSON` not copy paths to the store for `nix eval
--json`, `nix-instantiate --eval --json` and `nix-env --json`.

Fixes https://github.com/NixOS/nix/issues/5612
2022-08-22 15:01:35 +02:00
Eelco Dolstra
a5fd4ea94e parseFlakeRefWithFragment() improvements
In particular, plain paths no longer ignore query parameters
(e.g. '/foo/bar?lock=1').
2022-08-17 15:34:40 +02:00
Eelco Dolstra
18c6daf1a8 Simplify error message 2022-08-17 15:22:58 +02:00