Make more string values work as installables#7601
Merged
roberth merged 5 commits intoNixOS:masterfrom May 15, 2023
Merged
Conversation
738c727 to
7e946b5
Compare
Member
|
Seems like this would solve #7654 partially? Maybe allow the whole string to be printed in the repl and CLI? |
tomberek
reviewed
Jan 27, 2023
Ericson2314
commented
Jan 27, 2023
tomberek
reviewed
Jan 27, 2023
tomberek
reviewed
Jan 27, 2023
Ericson2314
commented
Jan 27, 2023
Ericson2314
commented
Jan 27, 2023
Ericson2314
commented
Jan 27, 2023
7e946b5 to
eca5eac
Compare
Ericson2314
commented
Jan 27, 2023
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
4 tasks
401d471 to
ee521ab
Compare
tomberek
reviewed
May 12, 2023
8aae7bf to
4614303
Compare
4 tasks
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 <[email protected]>
d7a5e35 to
d2162e7
Compare
roberth
approved these changes
May 15, 2023
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Jun 27, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Jun 27, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
8 tasks
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Jun 27, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Jul 31, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Oct 17, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Oct 23, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
Ericson2314
added a commit
to obsidiansystems/nix
that referenced
this pull request
Oct 23, 2023
Since PR NixOS#7601, we've had enough flexibility in our types of installables that it is no longer needed. Progress towards NixOS#7261
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
BuiltPathcontexts: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/**.shsrc/*/tests