-
-
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
--derivation
considered harmful, remove it in lieu of ^
and new stuff
#7261
Comments
--derivation
considered harmful, remove it in lieu of ^
and new commands--derivation
considered harmful, remove it in lieu of ^
and new stuff
BTW if the In this case, instead of saying |
Can you explain the difference between high-level and low-level installables? |
Low level is store-only, so just store paths with or without |
@Radvendii based on your nice fix in #7337, I thought you might be interested in this. |
#7467 tracks some of the documentation work needed for this to have a good UX. |
See the change log for user-facing details. Only two lines in the tests need changing, showing that the impact of this is pretty light. Progress towards NixOS#7261
See the change log for user-facing details. Only two lines in the tests need changing, showing that the impact of this is pretty light. Progress towards NixOS#7261 Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com>
@7c6f434c you might take an interest in this. |
The release notes document the change in behavior, I don't include it here so there is no risk to it getting out of sync. > Motivation >> Plumbing CLI should be simple Store derivation installations are intended as "plumbing": very simple utilities for advanced users and scripts, and not what regular users interact with. (Similarly, regular Git users will use branch and tag names not explicit hashes for most things.) The plumbing CLI should prize simplicity over convenience; that is its raison d'etre. If the user provides a path, we should treat it the same way not caring what sort of path it is. >> Scripting This is especially important for the scripting use-case. when arbitrary paths are sent to e.g. `nix copy` and the script author wants consistent behavior regardless of what those store paths are. Otherwise the script author needs to be careful to filter out `.drv` ones, and then run `nix copy` again with those paths and `--derivation`. That is not good! >> Surprisingly low impact Only two lines in the tests need changing, showing that the impact of this is pretty light. Many command, like `nix log` will continue to work with just the derivation passed as before. This because we used to: - Special case the drv path and replace it with it's outputs (what this gets rid of). - Turn those output path *back* into the original drv path. Now we just skip that entire round trip! > Context Issue NixOS#7261 lays out a broader vision for getting rid of `--derivation`, and has this as one of its dependencies. But we can do this with or without that. `Installable::toDerivations` is changed to handle the case of a `DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't need to do any extra work in that case. On this basis, commands like `nix {show-derivation,log} /nix/store/...-foo.drv` still work as before, as described above. Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com>
Per the old FIXME, this flag was on too many commands, and mostly ignored. Now it is just on the commands where it actually has an effect. Per NixOS#7261, I would still like to get rid of it entirely, but that is a separate project. This change should be good with or without doing that.
Discussed in the Nix team meeting 2022-02-27:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-02-27-nix-team-meeting-minutes-36/25890/1 |
I'm not convinced removing |
@edolstra This issue does not disagree that
should continue to work. What it says is that one should do
to get information about the derivation file itself. |
And so are store paths, to some extent. But that's the reference type the Nix store happens to use, so we have to expose it at the |
The release notes document the change in behavior, I don't include it here so there is no risk to it getting out of sync. > Motivation >> Plumbing CLI should be simple Store derivation installations are intended as "plumbing": very simple utilities for advanced users and scripts, and not what regular users interact with. (Similarly, regular Git users will use branch and tag names not explicit hashes for most things.) The plumbing CLI should prize simplicity over convenience; that is its raison d'etre. If the user provides a path, we should treat it the same way not caring what sort of path it is. >> Scripting This is especially important for the scripting use-case. when arbitrary paths are sent to e.g. `nix copy` and the script author wants consistent behavior regardless of what those store paths are. Otherwise the script author needs to be careful to filter out `.drv` ones, and then run `nix copy` again with those paths and `--derivation`. That is not good! >> Surprisingly low impact Only two lines in the tests need changing, showing that the impact of this is pretty light. Many command, like `nix log` will continue to work with just the derivation passed as before. This because we used to: - Special case the drv path and replace it with it's outputs (what this gets rid of). - Turn those output path *back* into the original drv path. Now we just skip that entire round trip! > Context Issue NixOS#7261 lays out a broader vision for getting rid of `--derivation`, and has this as one of its dependencies. But we can do this with or without that. `Installable::toDerivations` is changed to handle the case of a `DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't need to do any extra work in that case. On this basis, commands like `nix {show-derivation,log} /nix/store/...-foo.drv` still work as before, as described above. When testing older daemons, the post-build-hook will be run against the old CLI, so we need the old version of the post-build-hook to support that use-case. Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com>
The release notes document the change in behavior, I don't include it here so there is no risk to it getting out of sync. > Motivation >> Plumbing CLI should be simple Store derivation installations are intended as "plumbing": very simple utilities for advanced users and scripts, and not what regular users interact with. (Similarly, regular Git users will use branch and tag names not explicit hashes for most things.) The plumbing CLI should prize simplicity over convenience; that is its raison d'etre. If the user provides a path, we should treat it the same way not caring what sort of path it is. >> Scripting This is especially important for the scripting use-case. when arbitrary paths are sent to e.g. `nix copy` and the script author wants consistent behavior regardless of what those store paths are. Otherwise the script author needs to be careful to filter out `.drv` ones, and then run `nix copy` again with those paths and `--derivation`. That is not good! >> Surprisingly low impact Only two lines in the tests need changing, showing that the impact of this is pretty light. Many command, like `nix log` will continue to work with just the derivation passed as before. This because we used to: - Special case the drv path and replace it with it's outputs (what this gets rid of). - Turn those output path *back* into the original drv path. Now we just skip that entire round trip! > Context Issue NixOS#7261 lays out a broader vision for getting rid of `--derivation`, and has this as one of its dependencies. But we can do this with or without that. `Installable::toDerivations` is changed to handle the case of a `DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't need to do any extra work in that case. On this basis, commands like `nix {show-derivation,log} /nix/store/...-foo.drv` still work as before, as described above. When testing older daemons, the post-build-hook will be run against the old CLI, so we need the old version of the post-build-hook to support that use-case. Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
The release notes document the change in behavior, I don't include it here so there is no risk to it getting out of sync. > Motivation >> Plumbing CLI should be simple Store derivation installations are intended as "plumbing": very simple utilities for advanced users and scripts, and not what regular users interact with. (Similarly, regular Git users will use branch and tag names not explicit hashes for most things.) The plumbing CLI should prize simplicity over convenience; that is its raison d'etre. If the user provides a path, we should treat it the same way not caring what sort of path it is. >> Scripting This is especially important for the scripting use-case. when arbitrary paths are sent to e.g. `nix copy` and the script author wants consistent behavior regardless of what those store paths are. Otherwise the script author needs to be careful to filter out `.drv` ones, and then run `nix copy` again with those paths and `--derivation`. That is not good! >> Surprisingly low impact Only two lines in the tests need changing, showing that the impact of this is pretty light. Many command, like `nix log` will continue to work with just the derivation passed as before. This because we used to: - Special case the drv path and replace it with it's outputs (what this gets rid of). - Turn those output path *back* into the original drv path. Now we just skip that entire round trip! > Context Issue NixOS#7261 lays out a broader vision for getting rid of `--derivation`, and has this as one of its dependencies. But we can do this with or without that. `Installable::toDerivations` is changed to handle the case of a `DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't need to do any extra work in that case. On this basis, commands like `nix {show-derivation,log} /nix/store/...-foo.drv` still work as before, as described above. When testing older daemons, the post-build-hook will be run against the old CLI, so we need the old version of the post-build-hook to support that use-case. Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
The release notes document the change in behavior, I don't include it here so there is no risk to it getting out of sync. > Motivation >> Plumbing CLI should be simple Store derivation installations are intended as "plumbing": very simple utilities for advanced users and scripts, and not what regular users interact with. (Similarly, regular Git users will use branch and tag names not explicit hashes for most things.) The plumbing CLI should prize simplicity over convenience; that is its raison d'etre. If the user provides a path, we should treat it the same way not caring what sort of path it is. >> Scripting This is especially important for the scripting use-case. when arbitrary paths are sent to e.g. `nix copy` and the script author wants consistent behavior regardless of what those store paths are. Otherwise the script author needs to be careful to filter out `.drv` ones, and then run `nix copy` again with those paths and `--derivation`. That is not good! >> Surprisingly low impact Only two lines in the tests need changing, showing that the impact of this is pretty light. Many command, like `nix log` will continue to work with just the derivation passed as before. This because we used to: - Special case the drv path and replace it with it's outputs (what this gets rid of). - Turn those output path *back* into the original drv path. Now we just skip that entire round trip! > Context Issue NixOS#7261 lays out a broader vision for getting rid of `--derivation`, and has this as one of its dependencies. But we can do this with or without that. `Installable::toDerivations` is changed to handle the case of a `DerivedPath::Opaque` ending in `.drv`, which is new: it simply doesn't need to do any extra work in that case. On this basis, commands like `nix {show-derivation,log} /nix/store/...-foo.drv` still work as before, as described above. When testing older daemons, the post-build-hook will be run against the old CLI, so we need the old version of the post-build-hook to support that use-case. Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
I just want to contribute, that this issue bit me today. I used |
|
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
This was discussed in today's Nix team meeting some more
There is still some disagreement, but we agree on some next steps: Steps
Agreement on 1-3. Defer 4 until later.
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-01-08-nix-team-meeting-minutes-114/38156/1 |
It is therefore not part of the deriving path language, but a custom, CLI+scheduler-only language of deriving path sets. (sets: I don't think they're currently treated as lists) |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/pre-rfc-implement-dependency-retrieval-primitive/43418/5 |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-10-09-nix-team-meeting-minutes-185/54335/1 |
Reasons it is bad
No single meaning
--derivation
is a shared flag between all commands, but only some commands care about it at all:Other commands force one way or the other:
Still other commands force something like
--derivation
by hand, likenix log
:nix/src/nix/log.cc
Lines 45 to 52 in 499e99d
This makes for unpredictable behavior, which is a frustrating user experience.
Doesn't scale to CA derivations
In the CA derivation world, we cannot assume a path has one unique builder. This is true both for unstable floating CA derivations, and stable fixed CA derivations (fixed output derivations).
--derivation
fundamentally is meaningless, or non-determinstic (picking one of many builders) in an arbitrary way. This is no good.Doesn't scale to RFC 92
Currently, if one passes a
BuiltPath
derived path,--derivation
(andnix log
) always exacts thedrvPath
part. But with RFC 92 the output path could also be a derivation! This makes--derivation
confusing for users.It also leads to a loss of expressive power. Imagine if one wants
--derivation
for one argument but not another, e.g. forwhy-depends
asking why a computed derivation depends on another derivation:nix why-depends makeDrvs.anOutputWhichIsADrv gcc # oops cannot get gcc.drvPath which is what I want
What we should do instead
^
syntax (Low level<drvPath>^<outputName>
installable syntax to match existing<highLevelInstallable>^<outputNames>
syntax #4543) so it always works to select an output for every type of installable.foo.drvPath
an installable so we always have a nice way to select the derivation for high-level installabes.NixStringContextElem::DrvDeep
opt-in, and maybe deprecate it #7910.drv
(Get rid of.drv
special-casing for store path installable #7600) so we always have a nice way to select the derivation itself for low-level installablles.nix query-derivations
command, which given a store path will return all thederivations, output
that are known to produce it.--derivation
, in all cases make semantics the actual path not an extracteddrvPath
.nix log foo
should fail for consistency (!), because output paths don't have logs: derivations have logs. It can still have a nice "did you mean...?" error message leveraging the above.See also
The text was updated successfully, but these errors were encountered: