John Ericson
230c9b4329
Change types to prepare the way for CA derivations
...
We've added the variant to `DerivationOutput` to support them, but made
`DerivationOutput::path` partial to avoid actually implementing them.
With this chage, we can all collaborate on "just" removing
`DerivationOutput::path` calls to implement CA derivations.
2020-07-12 23:53:33 +00:00
John Ericson
fedfc913ad
Use more std::visit to prepare for new variant
...
N.B. not using `std::visit` for fetchurl because there is no attempt to
handle all the cases (e.g. no `else`) and lambda complicates early
return.
2020-07-12 23:51:40 +00:00
John Ericson
ffc18583b1
Move C++17 "pattern matching" boilerplat to utils.hh
2020-07-12 22:15:14 +00:00
John Ericson
503b425690
DerivationOutputExtensional -> DerivationOutputInputAddressed
...
Thanks @regnat for the great name.
2020-07-12 15:56:20 +00:00
John Ericson
a8d4707107
Undo erroneous indentation change
2020-07-12 15:54:12 +00:00
John Ericson
18152406ce
String .drv suffix to create derivation name
2020-07-12 15:40:14 +00:00
John Ericson
5d0b75e5b6
std::string_view for new derivation name parameters
2020-07-12 15:02:36 +00:00
Maximilian Bosch
64f03635d7
Fix ANSI color constants
...
The `m` acts as termination-symbol when declaring graphics. Because
of this, the `;1m` doesn't have any effect and is directly printed to
the console:
```
$ nix repl
> builtins.fetchGit { /* ... */ }
{ outPath = "/nix/store/s0f0iz4a41cxx2h055lmh6p2d5k5bc6r-source"; rev = "e73e45b723a9a6eecb98bd5f3df395d9ab3633b6"; revCount = ;1m428; shortRev = "e73e45b"; submodules = ;1mfalse; }
```
Introduced by 6403508f5a
.
2020-07-12 16:52:20 +02:00
John Ericson
13ec627e0a
Set derivation name in dervationStrict
2020-07-12 03:03:12 +00:00
John Ericson
1c9bec226f
Don't improperly assume path is store path
2020-07-12 02:38:03 +00:00
John Ericson
abea26a968
BasicDerivation::findOutput cannot return reference anymore
2020-07-12 01:57:06 +00:00
John Ericson
442d43178b
Merge remote-tracking branch 'upstream/master' into optional-derivation-output-storepath
2020-07-11 02:27:45 +00:00
Eelco Dolstra
8efa23bb99
Avoid a redundant hash
2020-07-10 15:56:24 +02:00
Eelco Dolstra
5dff49f661
Factor out commonality between nix-prefetch-url and nix-store --add-fixed
2020-07-10 13:21:37 +02:00
Eelco Dolstra
7f1a86d57c
nix-store --add-fixed: Run in constant memory
2020-07-10 12:51:56 +02:00
Eelco Dolstra
06e3dd9005
nix-prefetch-url: Run in constant memory when using RemoteStore
...
Fixes #3684 .
2020-07-10 11:22:48 +02:00
Matthew Bauer
a7884970c5
Fix DerivationOutputExtensional name
2020-07-09 11:37:18 -04:00
Eelco Dolstra
a2c27022e9
LocalStore::addToStore(srcPath): Handle the flat case
...
This helps nix-prefetch-url when using a local store.
2020-07-09 15:54:32 +02:00
Matthew Bauer
06a4e15478
Fix build.cc on linux
2020-07-08 19:27:51 -04:00
Matthew Bauer
8e0d0689be
Only store hash of fixed derivation output
...
we don’t need a full storepath for a fixedoutput derivation. So just
putting the ingestion method + the hash is sufficient.
2020-07-08 19:11:39 -04:00
Eelco Dolstra
b981e5aacf
Cleanup
2020-07-08 22:07:21 +02:00
Eelco Dolstra
34f25124ba
Make LocalStore::addToStore(srcPath) run in constant memory
...
This reduces memory consumption of
nix-instantiate \
-E 'with import <nixpkgs> {}; runCommand "foo" { src = ./blender; } "echo foo"' \
--option nar-buffer-size 10000
(where ./blender is a 1.1 GiB tree) from 1716 to 36 MiB, while still
ensuring that we don't do any write I/O for small source paths (up to
'nar-buffer-size' bytes). The downside is that large paths are now
always written to a temporary location in the store, even if they
produce an already valid store path. Thus, adding large paths might be
slower and run out of disk space. ¯\_(ツ)_/¯ Of course, you can always
restore the old behaviour by setting 'nar-buffer-size' to a very high
value.
2020-07-08 22:07:21 +02:00
Matthew Bauer
af95a7c16b
Add name to BasicDerivation
...
We always have a name for BasicDerivation, since we have a derivation
store path that has a name.
2020-07-08 15:38:01 -04:00
Eelco Dolstra
9223603908
Merge remote-tracking branch 'origin/master' into flakes
2020-07-08 15:55:19 +02:00
Eelco Dolstra
16ec7785ca
Fix 'got unknown message type 1 from Nix daemon'
...
Example:
$ nix-build -E 'with import <nixpkgs> {}; runCommand "foo" { x = runCommand "bar" {} "exit 1"; } "echo foo; exit 1"'
warning: unknown setting 'auto-allocate-uids'
these 2 derivations will be built:
/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv
/nix/store/k4fsvrjl7cp2xpz7927iv7g0dqj1zyhs-foo.drv
warning: unknown setting 'auto-allocate-uids'
building '/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv'...
error: --- Error ----------------------------------------------------------------------------------------------------------------------------------------------------------------- nix-daemon
builder for '/nix/store/v4fbdbhcdi949929a67g8farwf72zgam-bar.drv' failed with exit code 1
error: --- Error ------------------------------------------------------------------------------------------------------------------------------------------------------------------ nix-build
got unknown message type 1 from Nix daemon
2020-07-08 15:53:14 +02:00
Eelco Dolstra
1ab9da9154
Merge remote-tracking branch 'origin/master' into flakes
2020-07-07 14:38:57 +02:00
Eelco Dolstra
4055cfee36
Fix coverage build
2020-07-07 14:37:47 +02:00
Eelco Dolstra
7c9ece5dca
exportReferencesGraph: Fix support for non-top-level store paths
...
Fixes #3471 .
2020-07-07 14:25:43 +02:00
Ben Burdette
efd6a8b230
bump
2020-07-06 11:54:53 -06:00
Ben Burdette
75bfcf8d15
revamp trace code and test
2020-07-06 10:51:48 -06:00
Eelco Dolstra
68f524d717
nix develop: Support derivations with multiple outputs
2020-07-06 18:34:58 +02:00
Eelco Dolstra
cd8eb8a7d1
nix develop: Fall back to "bash" if nixpkgs#bashInteractive is unavailable
2020-07-06 17:08:54 +02:00
Eelco Dolstra
54712aaf8a
Merge remote-tracking branch 'origin/master' into flakes
2020-07-06 16:40:10 +02:00
Ben Burdette
a168224464
spacing
2020-07-04 18:30:49 -06:00
Ben Burdette
b29a4ea1dc
Merge branch 'master' into add-trace
2020-07-03 07:57:36 -06:00
Eelco Dolstra
c3c7aedbb5
nix develop: Fix bad regex
...
This was accepted by libstdc++ but not libc++.
https://hydra.nixos.org/build/123569154
2020-07-03 14:58:58 +02:00
Eelco Dolstra
6f8fd3a3f2
Shut up a clang warning
2020-07-03 14:50:07 +02:00
regnat
223fbe644a
Shorten the path to the test root
...
Fix a socket length failure on the OSX builders
2020-07-03 09:20:01 +02:00
Eelco Dolstra
b5e4253697
Fix abort in 'nix develop'
2020-07-02 18:24:11 +02:00
Ben Burdette
5818271c6e
spacing
2020-07-02 09:41:54 -06:00
Ben Burdette
bf2788e4c1
move showTrace to new loggerSettings
2020-07-02 09:04:31 -06:00
Ben Burdette
5ae498872a
assert for invalid fileorigin
2020-07-02 07:14:40 -06:00
Ben Burdette
8497891b99
spacing
2020-07-01 13:50:18 -06:00
Eelco Dolstra
6ff9aa8df7
Don't process an option if any of its arguments need completion
2020-07-01 20:31:39 +02:00
Eelco Dolstra
d746503e5c
Add --inputs-from to use flake inputs as registry entries
...
This allows you to refer to an input from another flake. For example,
$ nix run --inputs-from /path/to/hydra nixpkgs#hello
runs 'hello' from the 'nixpkgs' inputs of the 'hydra' flake.
Fixes #3769 .
2020-07-01 20:25:13 +02:00
Ben Burdette
a295b2ea96
if no errLoc, no Loc.
2020-07-01 12:02:02 -06:00
Ben Burdette
3629b0585a
don't include errpos for addErrorContext
2020-07-01 11:49:01 -06:00
Ben Burdette
2a39c083dc
non-pos trace test
2020-07-01 10:37:31 -06:00
Eelco Dolstra
38ccf2e241
Cleanup
2020-07-01 15:31:34 +02:00
Eelco Dolstra
86a4aba6c4
Merge branch 'remote-query-outputs' of https://github.com/tweag/nix
2020-07-01 15:10:29 +02:00
Eelco Dolstra
7d554f295c
Support building flakes from a shallow Git repo
...
Fixes #3756 .
2020-07-01 14:57:59 +02:00
Ben Burdette
a7d5d26443
fix tests with the 'from string' change
2020-06-30 22:05:21 -06:00
Ben Burdette
9159dfe3d8
comments and cleanup
2020-06-30 16:31:55 -06:00
Ben Burdette
70bcb39d3f
double addtrace for 'called from'
2020-06-30 15:44:19 -06:00
Ben Burdette
ddb81ca126
Merge branch 'master' into add-trace
2020-06-30 12:21:45 -06:00
Ben Burdette
a0705e0dd1
invalid pos check
2020-06-30 11:01:46 -06:00
Ben Burdette
e72a16a339
check for a null symbol
2020-06-30 11:00:51 -06:00
Ben Burdette
c484a67914
trace formatting
2020-06-29 15:46:21 -06:00
Eelco Dolstra
2b834d48aa
NAR parser: Fix missing name field check
...
Discovered by @Kloenk .
2020-06-29 22:45:41 +02:00
Eelco Dolstra
26cf0c674f
nix run: Use packages/legacyPackages as fallback if there is no app definition
...
'nix run' will try to run $out/bin/<name>, where <name> is the
derivation name (excluding the version). This often works well:
$ nix run nixpkgs#hello
Hello, world!
$ nix run nix -- --version
nix (Nix) 2.4pre20200626_adf2fbb
$ nix run patchelf -- --version
patchelf 0.11.20200623.e61654b
$ nix run nixpkgs#firefox -- --version
Mozilla Firefox 77.0.1
$ nix run nixpkgs#gimp -- --version
GNU Image Manipulation Program version 2.10.14
though not always:
$ nix run nixpkgs#git
error: unable to execute '/nix/store/kp7wp760l4gryq9s36x481b2x4rfklcy-git-2.25.4/bin/git-minimal': No such file or directory
2020-06-29 19:08:50 +02:00
Eelco Dolstra
50f13b06fb
EvalCache: Store string contexts
2020-06-29 19:08:37 +02:00
Ben Burdette
8f81fae116
showTrace flag in loggers
2020-06-29 10:20:51 -06:00
Eelco Dolstra
b681408879
Factor out EvalCache::forceDerivation()
2020-06-29 16:39:41 +02:00
Eelco Dolstra
ca946860ce
Fix bash completion
2020-06-29 14:37:22 +02:00
Eelco Dolstra
bc03c6f23d
Move App
2020-06-29 14:14:23 +02:00
Eelco Dolstra
58bc3b6578
Merge pull request #3729 from obsidiansystems/simpler-hased-mirror
...
hashed-mirrors: Use parsed derivation output rather than reconstructing it
2020-06-29 14:04:12 +02:00
Eelco Dolstra
64232f3ea6
Merge pull request #3749 from rodarima/master
...
Fall back to copyPath if link fails with EPERM
2020-06-29 13:31:24 +02:00
Ben Burdette
ef24a0835d
showtrace as function arg
2020-06-27 12:19:31 -06:00
Eelco Dolstra
adf2fbbdc2
Merge remote-tracking branch 'origin/master' into flakes
2020-06-26 08:46:46 +02:00
Ben Burdette
bc9e87412c
'string' makes more sense in nix repl
2020-06-25 09:56:32 -06:00
Ben Burdette
9ab808c926
showTrace flag for ErrorInfo; showTrace test.
2020-06-25 09:23:12 -06:00
Eelco Dolstra
de2641ae99
Fix empty std::optional dereference in writeDerivation()
...
https://hydra.nixos.org/build/123017579
2020-06-25 15:50:30 +02:00
Rodrigo
3a642187c3
Fall back to copyPath if link fails with EPERM
...
BeeGFS doesn't allow hard-links and returns EPERM, so we fall back
to copyPath. See https://github.com/NixOS/nix/issues/3748
2020-06-25 12:03:26 +02:00
Ben Burdette
9c0e1fd4f1
add trace test; error formatting refinements
2020-06-24 18:31:28 -06:00
Ben Burdette
6359d71d6b
re-enable --show-trace check
2020-06-24 18:28:20 -06:00
Ben Burdette
023912def3
convenience form of addTrace
2020-06-24 13:46:25 -06:00
Ben Burdette
93e9307329
repl indenting
2020-06-24 13:14:49 -06:00
Ben Burdette
b18ed02b76
repl indenting
2020-06-24 13:10:41 -06:00
regnat
d38f860c3e
Add a way to get all the outputs of a derivation with their label
...
Generalize `queryDerivationOutputNames` and `queryDerivationOutputs` by
adding a `queryDerivationOutputMap` that returns the map
`outputName=>outputPath`
(not that this is not equivalent to merging the results of
`queryDerivationOutputs` and `queryDerivationOutputNames` as sets don't
preserve the order, so we would end up with an incorrect mapping).
squash! Add a way to get all the outputs of a derivation with their label
Rename StorePathMap to OutputPathMap
2020-06-24 20:38:40 +02:00
Ben Burdette
6fe660acf9
re-remove
2020-06-24 12:33:05 -06:00
John Ericson
d9fb9e9f26
Merge remote-tracking branch 'upstream/master' into ca-drv
2020-06-24 15:41:29 +00:00
Ben Burdette
00fe653ea5
nixCode -> LinesOfCode
2020-06-24 08:33:53 -06:00
Ben Burdette
1d43a6e123
use plain errPos instead of nixCode; fix tests
2020-06-23 15:30:13 -06:00
Ben Burdette
d0e78fbb03
re-add Pos origin in tests
2020-06-23 10:51:58 -06:00
Ben Burdette
abe0552504
Merge remote-tracking branch 'upstream/master' into add-trace
2020-06-23 09:40:28 -06:00
Ben Burdette
13e87535ff
traces to bottom
2020-06-23 09:36:58 -06:00
Eelco Dolstra
09fc06daab
nix flake init: Use git add --force
2020-06-23 16:25:32 +02:00
Eelco Dolstra
015e1c2131
Merge pull request #3724 from bburdette/hintfmt-percent
...
Hintfmt percent test, and fix
2020-06-23 12:26:00 +02:00
Ben Burdette
9d1cb0c5e6
with normaltxt, elide yellow color code instead of canceling it; use normaltxt on plain_string hintfmt
2020-06-22 11:32:20 -06:00
Ben Burdette
28b079067f
Update src/libutil/fmt.hh
...
Co-authored-by: John Ericson <git@JohnEricson.me>
2020-06-22 10:00:37 -06:00
John Ericson
f4a5913125
hashed-mirrors: Use parsed derivation output rather than reconstructing it
...
Now the derivation outputs are parsed up front, we can avoid a reparse
by doing it. Also, this just feels a bit better as the `output*` env
vars are more of a `libnixexpr` interface than `libnixstore` interface:
ultimately, it's the derivation outputs that decide whether the
derivation is fixed-output.
Yes, hashed mirrors might go away with #3689 , but this bit of code would
be moved rather than deleted, so it's worth doing a cleanup anyways I
think.
2020-06-22 15:17:20 +00:00
Eelco Dolstra
334e26bfc2
nix flake check: Don't build apps
...
This was inconsistent since we're not building 'packages' or
'defaultPackage' either.
Closes #3726 .
2020-06-22 11:31:07 +02:00
John Ericson
93bbe6e8ab
Merge remote-tracking branch 'upstream/master' into ca-drv
2020-06-21 21:11:58 +00:00
John Ericson
3804e3df9b
Don't anticipate hash algo without hash in derivation for now
...
When we merge with master, the new lack of string types make this case
impossible (after parsing). Later, when we actually implemenent
CA-derivations, we'll change the types to allow that.
2020-06-21 21:05:37 +00:00
John Ericson
bf9f040112
Tweak declaration
...
I think this is clearer
2020-06-21 16:51:39 +00:00
John Ericson
fdeabf7160
Merge remote-tracking branch 'upstream/master' into multi-output-hashDerivationModulo
2020-06-21 16:43:17 +00:00
Ben Burdette
be4f444175
tidying up
2020-06-19 16:58:12 -06:00
Ben Burdette
0309488a66
fmt -> hintfmt test
2020-06-19 16:46:49 -06:00
Ben Burdette
397dbe114e
remove formathelper
2020-06-19 15:57:19 -06:00
Ben Burdette
b193aca4ae
escape percents
2020-06-19 15:29:19 -06:00