nix/tests/flakes
John Ericson d2162e7acd Make more string values work as installables
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 `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 #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 #7417

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-05-15 09:03:38 -04:00
..
absolute-paths.sh Trivial changes from the lazy-trees branch 2022-12-07 14:06:34 +01:00
build-paths.sh Make more string values work as installables 2023-05-15 09:03:38 -04:00
bundle.sh Move the 'nix bundle' tests 2022-07-13 20:49:07 +02:00
check.sh Harden tests' bash 2023-03-08 10:26:30 -05:00
circular.sh Split off the circular flake import tests 2022-07-13 20:37:32 +02:00
common.sh Cleanup test skipping 2023-03-16 18:43:03 -04:00
config.sh Move flake-local-settings.sh 2022-07-13 20:51:28 +02:00
flake-in-submodule.sh tests/flake-in-submodule: Remove unnecessary rm -rf 2023-03-18 14:39:38 +01:00
flakes.sh Create test lockfiles in TEST_ROOT 2023-03-19 14:14:30 +01:00
follow-paths.sh Harden tests' bash 2023-03-08 10:26:30 -05:00
init.sh Fix the flakes init test 2023-01-30 11:21:52 +01:00
inputs.sh flakes: Differentiate self.outPath and self.sourceInfo.outPath 2023-02-22 03:31:24 +01:00
mercurial.sh Cleanup test skipping 2023-03-16 18:43:03 -04:00
run.sh Move flakes tests to a subdirectory 2022-07-13 15:06:54 +02:00
search-root.sh Move flake-searching.sh and make it less dependent on git 2022-07-13 20:55:17 +02:00
show.sh tests/flakes/show.sh: Broaden requirement comment 2023-03-27 05:11:23 +02:00
unlocked-override.sh Trivial changes from the lazy-trees branch 2022-12-07 14:06:34 +01:00