nix/tests/ca
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-dry.sh Fix nix build --dry-run with CA derivations 2022-03-17 11:55:19 +01:00
build-with-garbage-path.sh Non-blocking garbage collector 2021-10-13 12:12:44 +02:00
build.sh Remove --derivation from test 2023-02-04 18:30:02 -05:00
common.sh tests: remove 'ca-references' feature 2022-04-21 10:06:39 +02:00
concurrent-builds.sh Allow running all the tests with the daemon 2021-07-27 17:06:11 +02:00
config.nix.in Add a test for nix run with CA derivations 2021-05-17 15:10:48 +02:00
content-addressed.nix Enable/fix tests in nix-static 2022-06-22 23:33:15 +02:00
duplicate-realisation-in-closure.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
flake.nix Add a test for nix run with CA derivations 2021-05-17 15:10:48 +02:00
gc.sh Allow running all the tests with the daemon 2021-07-27 17:06:11 +02:00
import-derivation.sh Fix IFD with CA derivations 2021-12-21 09:36:50 +01:00
new-build-cmd.sh Test nix build --json return output paths in floating CA case 2023-02-10 18:04:13 -05:00
nix-copy.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
nix-run.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
nix-shell.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
nondeterministic.nix Add a test for the “two glibc” issue 2021-06-23 11:18:31 +02:00
post-hook.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
racy.nix Properly lock the builds of CA derivations 2021-07-20 06:57:56 +02:00
recursive.sh Test nix build --json return output paths in floating CA case 2023-02-10 18:04:13 -05:00
repl.sh Fix nix repl’s building of CA derivations 2021-11-05 11:04:14 +01:00
selfref-gc.sh tests: remove 'ca-references' feature 2022-04-21 10:06:39 +02:00
signatures.sh tests/common.sh.in: Add enableFeatures helper 2022-03-02 21:48:25 +01:00
substitute.sh Get rid of .drv special-casing for store path installables 2023-02-28 17:07:05 -05:00
why-depends.sh add explanation and test 2022-11-23 12:06:47 -05:00