-
Notifications
You must be signed in to change notification settings - Fork 248
Derive nix profile from flake: attempt 2 #1724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
3e1be89
to
5cbd4a9
Compare
7e4e95d
to
b9a4588
Compare
5cbd4a9
to
6788172
Compare
b9a4588
to
062cc7f
Compare
9fe6bea
to
b0dd286
Compare
@mikeland73 @gcurtis I think this is 95% there. The PTAL and let me know what you think. |
336ce68
to
1f0aead
Compare
func (i *NixProfileListItem) StorePaths() []string { | ||
return i.nixStorePaths | ||
} |
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.
Export instead?
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.
Since all the fields in this struct are private, I wanted to maintain that constraint. Makes it easier to reason about.
recomputeState := mode == ensure || d.IsEnvEnabled() | ||
if recomputeState { | ||
if err := d.recomputeState(ctx, mode); err != nil { | ||
if mode == install || mode == update || mode == ensure { |
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.
!= remove
?
1f0aead
to
62f5cb2
Compare
62f5cb2
to
7fc9961
Compare
This reverts commit 03a1c2b.
This reverts commit 03a1c2b.
Summary
This PR is a re-write of #1692. See motivation and discussion there.
Motivation
This PR seeks to unify our nix print-dev-env and nix profile steps. Other benefits:
Previously, these would be two separate processes: we'd manually do nix profile install.
Now, we get the
buildInputPaths
fromnix print-dev-env
and install those, so the nix profile is derived from the flake.Implementation notes
ensureStateIsUpToDate
, I had to modify the logic in Derive nix profile from flake: attempt 2 #1724: calld.installPackages
that creates plugin files, installs runx and nix packages. Also, move all lockfile operations to the end for all modes, instead of just forrecomputeState == true
.nix build
operation now happens with the[1/3] [email protected]: Success
output that previously would happen withnix profile install
.nixprofiles.NixProfileInstall
, we first install vianix build
to ensure the package is installed in the local nix store. We then calldevbox.syncNixProfile
to get thebuildInputs
fromdevbox.computeEnv
andnix profile install $buildInputs
.How was it tested?
devbox add hello cowsay
anddevbox rm hello cowsay
.To verify that we can install packages in
/nix/store
duringdevbox add
, and then use that during offline indevbox shell
:devbox add [email protected]
devbox shell
and exit, or justdevbox install
.devbox shell
and verify that the newly installed version ofpython
is used.BEFORE: we could skip step 2, because we directly installed packages in the nix profile
AFTER: step 2 is required because we re-evaluate the flake's environment and derive nix profile from it.