Geoff Reedy
9d67332e4b
Better eval error locations for interpolation and +
...
Previously, type or coercion errors for string interpolation, path
interpolation, and plus expressions were always reported at the
beginning of the outer expression. This leads to confusing evaluation
error messages making it hard to accurately diagnose and then fix the
error.
For example, errors were reported as follows.
```
cannot coerce an integer to a string
1| let foo = 7; in "bar" + foo
| ^
cannot add a string to an integer
1| let foo = "bar"; in 4 + foo
| ^
cannot coerce an integer to a string
1| let foo = 7; in "x${foo}"
| ^
```
This commit changes the ExprConcatStrings expression vector to store a
sequence of expressions *and* their expansion locations so that error
locations can be reported accurately. For interpolation, the error is
reported at the beginning of the entire `${foo}`, not at the beginning
of `foo` because I thought this was slightly clearer. The previous
errors are now reported as:
```
cannot coerce an integer to a string
1| let foo = 7; in "bar" + foo
| ^
cannot add a string to an integer
1| let foo = "bar"; in 4 + foo
| ^
cannot coerce an integer to a string
1| let foo = 7; in "x${foo}"
| ^
```
The error is reported at this kind of precise location even for
multi-line indented strings.
This probably helps with at least some of the cases mentioned in #561
2021-09-22 20:57:34 -06:00
Eelco Dolstra
bcd73ebf60
Add missing #include
...
Fixes #5282 .
2021-09-22 12:14:50 +02:00
Eelco Dolstra
60cc975d22
Set input parent at construction time
2021-09-21 14:07:16 +02:00
Eelco Dolstra
06557299b3
Allow relative paths anywhere into the parent's store path
2021-09-21 13:45:11 +02:00
Eelco Dolstra
5cbb9c5406
path fetcher: Fix relative path check
2021-09-21 13:19:26 +02:00
Gregor Kleen
fd67a0f927
Fix scheme argument to s3 cache
2021-09-17 10:45:19 +02:00
Geoff Reedy
cbe9ddfd1a
Include subpath in flake fingerprint
...
Without this, flakes within the same tree and same lock data will have
the same fingerprint and the eval cache for one flake will be
incorrectly used for another.
2021-09-16 15:58:21 -06:00
Eelco Dolstra
1ec4efa6c8
Merge pull request #5257 from edolstra/dirty-lock-file
...
If we can't write a lock file, pretend the top-level flake is dirty
2021-09-15 20:18:23 +02:00
Eelco Dolstra
c17f3c5e69
Merge branch 'mh/fix-chroot-eval' of https://github.com/obsidiansystems/nix
2021-09-15 18:37:58 +02:00
Eelco Dolstra
027344ce7e
If we can't write a lock file, pretend the top-level flake is dirty
...
Alternative to #4639 . You can still read flake.lock, but at least in
reproducible workflows like NixOS configurations where you require a
non-dirty tree, evaluation will fail because there is no rev.
2021-09-15 18:31:42 +02:00
Eelco Dolstra
991cc53386
Revert "Disallow reading flake.lock"
...
This reverts commit e5596113f7
.
2021-09-15 18:30:37 +02:00
Emily
56025ad3b1
sandbox: allow Rosetta 2 on Darwin
...
This allows sandboxed x86_64-darwin builds on aarch64-darwin.
2021-09-15 02:02:03 +01:00
Eelco Dolstra
fda4efff87
Rename unnecessary git@
2021-09-14 22:53:31 +02:00
Eelco Dolstra
5ee3ee1a6b
Merge pull request #5249 from edolstra/nix-profile
...
Add missing 'nix profile' subcommands
2021-09-14 22:27:19 +02:00
Eelco Dolstra
e5596113f7
Disallow reading flake.lock
...
With --no-write-lock-file, it's possible that flake.lock is out of
sync with the actual inputs used by the evaluation. So doing fromJSON
(readFile ./flake.lock) will give wrong results.
Fixes #4639 .
2021-09-14 21:09:11 +02:00
Eelco Dolstra
b41968f15a
nix profile history: Show profile date
2021-09-14 20:47:33 +02:00
Eelco Dolstra
4b738fc7a9
Add 'nix profile wipe-history' command
2021-09-14 20:35:41 +02:00
Eelco Dolstra
f359b9981b
Generations -> profile versions
2021-09-14 19:57:45 +02:00
Eelco Dolstra
229ad612b8
Fix quotes
2021-09-14 19:48:16 +02:00
Eelco Dolstra
817562e694
Add "nix profile rollback" command
2021-09-14 19:32:33 +02:00
Eelco Dolstra
1fbaf36729
nix flake show --json: Add type info
...
For extensibility, every leaf node is now an object that contains at
least a type field (e.g. "type": "derivation").
2021-09-14 17:18:29 +02:00
Eelco Dolstra
f3259af73e
Merge branch 'tomberek/show_json' of https://github.com/tomberek/nix
2021-09-14 16:58:35 +02:00
Eelco Dolstra
d589a6aa8a
Merge pull request #5247 from edolstra/stablize-ca-references
...
Remove the 'ca-references' feature check
2021-09-14 15:42:50 +02:00
Eelco Dolstra
75837bb595
Respect NO_COLOR in Markdown output
2021-09-14 14:57:58 +02:00
Eelco Dolstra
7e4dd0e279
Merge pull request #5248 from edolstra/flake-clone
...
Fix 'nix flake clone' on github repos
2021-09-14 14:14:59 +02:00
Eelco Dolstra
01a4fa3b6e
Advise using --extra-experimental-features instead of --experimental-features
...
Fixes #3737 .
2021-09-14 13:56:36 +02:00
Eelco Dolstra
761ac9d584
Remove the 'ca-references' feature check
...
Fixes #3422 .
Fixes #4425 .
2021-09-14 13:53:20 +02:00
Eelco Dolstra
07996c4810
github fetcher: Don't use HEAD branch when cloning
...
Fixes #4394 .
2021-09-14 13:38:45 +02:00
Eelco Dolstra
d72d31d529
github fetcher: Use git+https for cloning
...
git+ssh only works if you have SSH access.
2021-09-14 13:38:05 +02:00
Eelco Dolstra
a4ae601b44
Merge pull request #5245 from edolstra/warnings
...
Change warning messages from yellow to magenta
2021-09-14 11:46:34 +02:00
Eelco Dolstra
16d4922dd2
Merge pull request #5240 from edolstra/builtin-help
...
nix --help: Display help using lowdown instead of man
2021-09-14 11:31:23 +02:00
Eelco Dolstra
58b5036c54
Change warnings from yellow to magenta
...
This matches gcc and clang.
2021-09-14 10:42:29 +02:00
Eelco Dolstra
4ffda0af7c
ANSI_YELLOW -> ANSI_WARNING
2021-09-14 10:42:29 +02:00
Eelco Dolstra
76e368a3b4
Fix macOS build
2021-09-14 10:07:31 +02:00
Eelco Dolstra
1ba993d07c
Fix clang warning
2021-09-14 08:15:33 +02:00
Eelco Dolstra
4ed66735b6
RunOptions: Use designated initializers
...
Also get rid of _killStderr because it wasn't actually checked
anywhere.
2021-09-13 23:31:04 +02:00
Eelco Dolstra
c3e9acd1c0
Remove tabs
2021-09-13 23:06:33 +02:00
kvtb
c6fa7775de
hashFile, hashString: realize context before calculation, and discard afterwards
2021-09-13 22:34:58 +02:00
Eelco Dolstra
49a932fb18
nix --help: Display help using lowdown instead of man
...
Fixes #4476 .
Fixes #5231 .
2021-09-13 14:45:21 +02:00
Eelco Dolstra
8796b1b5e3
Fix markdown error
2021-09-13 14:44:53 +02:00
Eelco Dolstra
eadb45c4db
Use Bindings::{get,need} instead of find
2021-09-13 13:53:24 +02:00
Eelco Dolstra
a73be28717
renderMarkdownToTerminal(): Fix terminal width computation
2021-09-13 13:52:14 +02:00
Eelco Dolstra
ff09acd1f9
Remove tabs
2021-09-10 11:00:50 +02:00
Eelco Dolstra
02ece164be
Make installables const
2021-09-10 10:39:39 +02:00
Eelco Dolstra
1e43bc6dc0
Merge pull request #5224 from baloo/baloo/5089/force-nss_dns-load
...
preloadNSS: fixup nss_dns load
2021-09-09 10:37:41 +02:00
Tom Bereknyei
dc25856d74
Ensure nix flake show produces valid json
2021-09-08 19:38:22 -04:00
Arthur Gautier
3b72741f23
preloadNSS: load NSS before threads are started
...
preloadNSS is not thread-safe, this commit moves it before we start the
first thread.
Signed-off-by: Arthur Gautier <baloo@superbaloo.net>
2021-09-08 18:29:31 +00:00
Eelco Dolstra
b71428c907
Merge branch 'fix-3976' of https://github.com/mkenigs/nix
2021-09-08 14:43:12 +02:00
Naïm Favier
7f0d177ce7
Add missing include in util.cc
2021-09-08 12:20:08 +02:00
Eelco Dolstra
9180239081
Merge pull request #5215 from ncfavier/patch-1
...
Fix use-registries logic in builtins.getFlake
2021-09-08 11:19:39 +02:00