-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Make more string values work as installables #7601
Conversation
738c727
to
7e946b5
Compare
Seems like this would solve #7654 partially? Maybe allow the whole string to be printed in the repl and CLI? |
7e946b5
to
eca5eac
Compare
f57d7f4
to
aeb330a
Compare
aeb330a
to
62ccb73
Compare
🎉 All dependencies have been resolved ! |
62ccb73
to
d64ad07
Compare
d64ad07
to
7303910
Compare
7303910
to
153952e
Compare
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.
Needs a bit of cleanup.
401d471
to
ee521ab
Compare
8aae7bf
to
4614303
Compare
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.
Almost there 🚀
This well help us with some unit testing
This gives us some round trips to test. `EvalState::coerceToDerivedPathUnchecked` is a factored out helper just for unit testing.
As discussed in NixOS#7417, it would be good to make more string values work as installables. That is to say, if an installable refers to a value, and the value is a string, it used to not work at all, since NixOS#7484, it works somewhat, and this PR make it work some more. The new cases that are added for `BuiltPath` contexts: - Fixed input- or content-addressed derivation: ``` nix-repl> hello.out.outPath "/nix/store/jppfl2bp1zhx8sgs2mgifmsx6dv16mv2-hello-2.12" nix-repl> :p builtins.getContext hello.out.outPath { "/nix/store/c7jrxqjhdda93lhbkanqfs07x2bzazbm-hello-2.12.drv" = { outputs = [ "out" ]; }; } The string matches the specified single output of that derivation, so it should also be valid. - Floating content-addressed derivation: ``` nix-repl> (hello.overrideAttrs (_: { __contentAddressed = true; })).out.outPath "/1a08j26xqc0zm8agps8anxpjji410yvsx4pcgyn4bfan1ddkx2g0" nix-repl> :p builtins.getContext (hello.overrideAttrs (_: { __contentAddressed = true; })).out.outPath { "/nix/store/qc645pyf9wl37c6qvqzaqkwsm1gp48al-hello-2.12.drv" = { outputs = [ "out" ]; }; } ``` The string is not a path but a placeholder, however it also matches the context, and because it is a CA derivation we have no better option. This should also be valid. We may also want to think about richer attrset based values (also discussed in that issue and NixOS#6507), but this change "completes" our string-based building blocks, from which the others can be desugared into or at least described/document/taught in terms of. Progress towards NixOS#7417 Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
d7a5e35
to
d2162e7
Compare
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-05-12-nix-team-meeting-minutes-54/28197/1 |
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Motivation
As discussed in #7417, it would be good to make more string values work as installables. That is to say, if an installable refers to a value, and the value is a string, it used to not work at all, since #7484, it works somewhat, and this PR make it work some more.
The new cases that are added for
BuiltPath
contexts:Fixed input- or content-addressed derivation:
Floating content-addressed derivation:
The string is not a path but a placeholder, however it also matches the context, and because it is a CA derivation we have no better option. This should also be valid.
Context
See #7417, where these ideas were discussed.
The history is broken out to be legible. One can review commit-by-commit to see all the support infra put in place before it is finally used in the last commit.
We may also want to think about richer attrset based values (also discussed in that issue and #6507), but this change "completes" our string-based building blocks, from which the others can be desugared into or at least described/document/taught in terms of.
Depends on #7710Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests