lix/src
John Ericson ea0adfc582 Get rid of .drv special-casing for store path installables
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 #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>
2023-02-28 17:07:05 -05:00
..
build-remote build-remote: store maxBuildJobs before forcing it to 1 2023-02-07 12:08:00 +01:00
libcmd Get rid of .drv special-casing for store path installables 2023-02-28 17:07:05 -05:00
libexpr Merge pull request #7911 from edolstra/revert-7689 2023-02-28 08:46:55 +01:00
libfetchers Example uses gitlab.com thus clarify the comment 2023-02-24 07:17:47 -08:00
libmain Fix building with GCC 9 2023-02-10 18:38:57 +01:00
libstore Merge pull request #7793 from layus/interrupt_downloads 2023-02-28 13:29:29 +01:00
libutil url: make percentEncode stricter, expose and unit test it 2023-02-27 15:30:00 +01:00
nix Merge pull request #7755 from obsidiansystems/mix-read-only-mode 2023-02-21 16:13:48 +01:00
nix-build nix-shell: Colour the prompt red if the user is root 2023-02-01 20:50:44 +00:00
nix-channel A setting to follow XDG Base Directory standard 2023-02-10 20:14:06 +04:00
nix-collect-garbage Add missing rethrows in conditional exception handlers 2022-06-10 10:52:41 -07:00
nix-copy-closure copyPaths: Pass store by reference 2021-07-22 09:59:51 +02:00
nix-env A setting to follow XDG Base Directory standard 2023-02-10 20:14:06 +04:00
nix-instantiate Revert to copyStore = true for nix-instantiate and nix-env 2022-08-23 14:40:27 +02:00
nix-store Fix unused variable warning 2022-12-12 16:41:46 +01:00
resolve-system-dependencies Get rid of most .at calls (#6393) 2022-05-04 07:44:32 +02:00
toml11 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00