-
-
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
Document <drvPath>^<outputName> syntax for installables #9362
Conversation
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.
Nice!
I'm not sure about the installables part, @Ericson2314 will know better.
- Either: | ||
- one of the store derivation's [output names](#gloss-output-name) or | ||
- the character `*` | ||
|
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.
A plain store derivation path refers to the first output declared for that derivation. | |
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.
Hrm, @fricklerhandwerk did you mean to delete those lines in your suggestion, or did you intend to only add the new line?
We should document "Deriving Paths" first. That is the underlying concept. The fact that those never got documented means people just see ad-hoc syntax and don't know how to think about it. That is the first problem. This is the same thing I think should block #8595 too. |
But yes you are right @amjoseph-nixpkgs, Store paths are a type of Deriving Path ("constant" deriving paths @roberth came up with the name), which in turn are type of installable. We also support |
@Ericson2314 none of that should be blocking here. IMO this can be fixed up and merged. |
@fricklerhandwerk I think it is blocking because it is quite annoying to get text that is inline and delete it later. Much better to have the small pages/outline so people know what they should document / what they should refer to to the get go. https://github.com/NixOS/nix/compare/document-derivation-and-deriving-path I pushed some text there taken from my other branch. I also got rid of "store derivation" per @roberth's #6507. I think if we fix that stuff up it will take a little bit but not too long, and then we'll have a much better foundation for these other things. It's really important to me that read don't waste neurons building independent mental models for:
because they missed the fact that these are all essentially the same thing. |
Co-authored-by: Valentin Gagarin <[email protected]>
Co-authored-by: Valentin Gagarin <[email protected]>
Co-authored-by: Valentin Gagarin <[email protected]>
Co-authored-by: Valentin Gagarin <[email protected]>
Okay but if that is not imminent we should at least merge a one-line change that adds the fifth bullet point to the definition of installable. Even if it's a placeholder. Otherwise there's a huge gap between the documented behavior and the actual behavior -- for nearly every command.
Is there a PR to discuss this? 👍 I like the addition of the qualifier
👎 I would leave it. Then we have two clearly-defined terms:
Anybody who neglects to include one of the two qualifiers is asking the reader to infer the qualifier themselves... which is how we talk on github and irc but not appropriate for polished documentation. Regarding #6507, that PR is correct that:
... and I don't think that's going to change in the immediate future, or without some raging debates occurring. I think we should let sleeping dogs lie here and not try to define "package" in the Nix manual. At least for now.
Yeah I was going to mention that. It's one reason I picked "store derivation output reference"... it means we can define the parallel concept "flake attribute output reference" for the thing you get when you put
... but not for |
@amjoseph-nixpkgs So on second thought in the Nix Team meeting I think I am scope creeping too much so It is better to just begin with your PR. Can you add the glossary entry for deriving paths from #8595 and then reference that? That will do for now. |
- [Store derivation output reference](@docroot@/glossary.md#gloss-store-derivation-output-reference) | ||
- [Store path](#store-path) |
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.
Then both these become deriving path
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.
And down below the "Store path" description becomes "Deriving Path"
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.
Also see the "Derivation output selection" section down below.
> Reference to the `man` output of a given `bash-5.2-p15` derivation: | ||
> | ||
> `/nix/store/llil5bng8p7203l25mqb5lwdhlaya4d9-bash-5.2-p15.drv^man` | ||
|
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.
See also: The store path section of the [installables syntax](@docroot@/command-ref/new-cli/nix.html#store-path), where output references are used. | |
It'd be good to link or explain what this syntax is a part of and where it's used.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-11-17-nix-team-meeting-minutes-104/35753/1 |
The
^
syntax for installables was added in these three PRs:<drvPath>^<outputName>
installable syntax to match existing<highLevelInstallable>^<outputNames>
syntax #4543.drv
special-casing for store path installable #7600... but was not added to the manual. This commit documents the syntax for this fifth type of installable.
My earlier complaints about vagueness in #4543 are solved if
/nix/store/xyz.drv^outname
counts as an installable, since this syntax gives us a way to use installable-accepting commands (likenix copy
) on a derivation without using the command on its outputs (or vice versa).At the time of that discussion the
^
syntax had not yet reached the then-stable version of Nix, and I didn't find out about it until a few months ago. I think it is awesome. The--derivation
flag always seemed like an ugly hack.Anyways, I assume that the intent is that
/nix/store/xyz.drv^outname
counts as an installable. If so, this is my attempt at documenting that fact.