-
Notifications
You must be signed in to change notification settings - Fork 69
builder: split nix-instantiate & nix-build #117
builder: split nix-instantiate & nix-build #117
Conversation
498e81f
to
252d0e7
Compare
src/nix.rs
Outdated
attribute: Option<String>, | ||
result_gc_root_path: Option<PathBuf>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right off the bat feedback: this isn't workable. We need to GC root everything Nix evaluates and builds, and enforce it at the type system level.
One improvement on the way it works on master is if a store path result from the Nix evaluator carries with it its tempdir handle, forcing the tempdir to stay alive until the Nix value is garbage collected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what effectively happened is: Once I removed the lorri shell
subcommand, no code whatsoever is using this stuff anymore. The only part that creates a gc root is the store path generated by logged-evaluation.nix
, and that is handled by roots
. I’m thinking about completely removing this from the builder for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, the problem with creating the roots after a build is that there is a small period of time (race condition) where a GC could delete the store path. Thus we must pass the gc root to the nix build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is resolved by basing this branch on #131. PTAL
64a980a
to
07e4e96
Compare
07e4e96
to
c712e01
Compare
Rebased & ready for review. |
e285e19
to
a54af4a
Compare
b279440
to
4e020e5
Compare
I split this PR up in multiple PRs for easier review:
And the rest of the commits are in this PR. |
630502b
to
27afeba
Compare
65cb5b9
to
a7e1184
Compare
27afeba
to
c576b95
Compare
a7e1184
to
5292d7e
Compare
26543c5
to
90aebe2
Compare
eccd66f
to
ab6535e
Compare
24d0305
to
8ae8699
Compare
1f73f45
to
fa64be3
Compare
8ae8699
to
fc9141a
Compare
fa64be3
to
e7acd51
Compare
fc9141a
to
a37fd0a
Compare
The build is split into a two-step process: - nix-instantiate, which is called with -vv and parses its stderr (and produces drv files) - nix-build, which builds the drv file The idea behind this is that we can’t easily write tests which use `nix-build` (nix-in-nix problem), so we are only gonna use the first step for tests (which is enough to check the stderr parsing stuff). Another problem this solves is that the stderr of nix-build is now separated from the stderr of nix-instantiate, and nix-build is not called with -vv, meaning we can show it to the user while it’s generated, making it possible to fix the silence problem lorri has. Closes #126
lorri would crash if the instantiation works but the build has an error; because we didn’t convert the build errors into `Info::Success`. Closes #121
We don’t capture the build output of nix-build at the moment, so let’s use `nix-store --read-log` to check whether the non-utf8 sequence is there.
a37fd0a
to
f57b79b
Compare
The older version of Nix on darwin (2.0) had a bug where it wouldn't interpret a symlink as a `.drv`. The upstream Travis support for newer Nixes on Darwin is a bit broken, so this is working around that for now. The default language changes to `minimal`, but the Linux version overrides it to `nix`.
holy cow, I can’t believe it’s merged |
A bit of refactoring, to finally split the instantiation and build (see last commit).
Please review commit-by-commit.
PathBuf
to distinguish drv files and final build resultsOutputPaths
to keep results oflogged-evalatuion.nix
& move errors from use time to parse timelorri shell
(Part of the fix for #58)
Closes #143
Closes #50