lix/tests
Maximilian Bosch c1c37f3200
flakes: throw an error if follows-declaration for an input is invalid
I recently got fairly confused why the following expression didn't have
any effect

    {
      description = "Foobar";
      inputs.sops-nix = {
        url = github:mic92/sops-nix;
        inputs.nixpkgs_22_05.follows = "nixpkgs";
      };
    }

until I found out that the input was called `nixpkgs-22_05` (please note
the dash vs. underscore).

IMHO it's not a good idea to not throw an error in that case and
probably leave end-users rather confused, so I implemented a small check
for that which basically checks whether `follows`-declaration from
overrides actually have corresponding inputs in the transitive flake.

In fact this was done by accident already in our own test-suite where
the removal of a `follows` was apparently forgotten[1].

Since the key of the `std::map` that holds the `overrides` is a vector
and we have to find the last element of each vector (i.e. the override)
this has to be done with a for loop in O(n) complexity with `n` being
the total amount of overrides (which shouldn't be that large though).

Please note that this doesn't work with nested expressions, i.e.

    inputs.fenix.inputs.nixpkgs.follows = "...";

which is a known problem[2].

For the expression demonstrated above, an error like this will be
thrown:

    error: sops-nix has a `follows'-declaration for a non-existant input nixpkgs_22_05!

[1] 2664a216e5
[2] https://github.com/NixOS/nix/issues/5790
2022-07-12 10:18:38 +02:00
..
ca
config
lang Handle EOFs in string literals correctly 2022-05-25 17:58:13 +02:00
plugins
add.sh
bad.tar.xz
bash-profile.sh
big-derivation-attr.nix
binary-cache-build-remote.sh
binary-cache.sh
brotli.sh Move 'nix hash-*' and 'nix to-*' to 'nix hash' 2020-12-03 17:55:55 +01:00
build-dry.sh
build-hook-ca-fixed.nix
build-hook-ca-floating.nix
build-hook.nix
build-remote-content-addressed-fixed.sh
build-remote-content-addressed-floating.sh
build-remote-input-addressed.sh
build-remote.sh
build.sh
ca-shell.nix
case-hack.sh
case.nar
check-refs.nix
check-refs.sh
check-reqs.nix
check-reqs.sh
check.nix
check.sh
common.sh.in
compression-levels.sh
compute-levels.sh
config.nix.in
config.sh
db-migration.sh
dependencies.builder0.sh
dependencies.nix
dependencies.sh
describe-stores.sh
dummy
dump-db.sh Allow running all the tests with the daemon 2021-07-27 17:06:11 +02:00
eval-store.sh
eval.nix
eval.sh
export-graph.nix
export-graph.sh
export.sh
failing.nix
fetchClosure.sh
fetchGit.sh
fetchGitRefs.sh
fetchGitSubmodules.sh
fetchMercurial.sh
fetchPath.sh
fetchTree-file.sh
fetchurl.sh
filter-source.nix
filter-source.sh
fixed.builder1.sh
fixed.builder2.sh
fixed.nix
fixed.sh
flake-bundler.sh
flake-local-settings.sh Replace defaultBla.$system with bla.$system.default 2022-02-22 11:47:41 +01:00
flake-searching.sh Replace defaultBla.$system with bla.$system.default 2022-02-22 11:47:41 +01:00
flakes-run.sh Fix compilation, style fixes 2022-04-19 13:41:32 +02:00
flakes.sh
fmt.sh
fmt.simple.sh nix-fmt: add command 2022-03-11 10:00:19 -05:00
function-trace.sh Fix function-trace test case 2021-11-04 15:04:04 +01:00
gc-auto.sh
gc-concurrent.builder.sh
gc-concurrent.nix
gc-concurrent.sh
gc-concurrent2.builder.sh
gc-non-blocking.sh
gc-runtime.nix
gc-runtime.sh
gc.sh
github-flakes.nix
hash-check.nix
hash.sh
import-derivation.nix
import-derivation.sh Don't put results symlinks in the tests directory 2012-09-11 19:14:15 -04:00
impure-derivations.nix
impure-derivations.sh tests/impure-derivations.sh: Ensure that inputAddressed build fails 2022-03-31 17:38:15 +02:00
init.sh
install-darwin.sh
lang.sh
linux-sandbox.sh Allow running all the tests with the daemon 2021-07-27 17:06:11 +02:00
local-store.sh
local.mk
logging.sh Implement regression test for empty logs loaded via nix log 2022-03-24 22:31:52 +01:00
misc.sh
multiple-outputs.nix
multiple-outputs.sh
nar-access.nix
nar-access.sh
nix-build-examples.nix
nix-build.sh
nix-channel.sh
nix-copy-closure.nix
nix-copy-ssh.sh
nix-profile.sh
nix-shell.sh
nix_path.sh
nss-preload.nix
optimise-store.sh
parallel.builder.sh
parallel.nix
parallel.sh
pass-as-file.sh
path.nix
placeholders.sh
plugins.sh
post-hook.sh
pure-eval.nix
pure-eval.sh
push-to-store.sh
readfile-context.builder.sh
readfile-context.nix
readfile-context.sh
recursive.sh
referrers.sh
remote-builds.nix
remote-store.sh Add a test ensuring compatibility with an old daemon 2021-03-16 14:20:41 +01:00
repair.sh Make --repair-path also repair corrupt optimised links 2022-01-11 11:57:45 +01:00
repl.sh
restricted.nix
restricted.sh
search.nix tests: test nix search behavior 2018-02-25 16:40:05 -06:00
search.sh
secure-drv-outputs.nix
secure-drv-outputs.sh
selfref-gc.sh
setuid.nix
shell-hello.nix Allow selecting derivation outputs using 'installable!outputs' 2022-05-03 13:43:52 +02:00
shell.nix
shell.sh
shell.shebang.rb
shell.shebang.sh
signing.sh
simple-failing.nix
simple.builder.sh
simple.nix
simple.sh
sourcehut-flakes.nix
ssh-relay.sh
store-ping.sh
structured-attrs-shell.nix
structured-attrs.nix
structured-attrs.sh
substitute-with-invalid-ca.sh
suggestions.sh
tarball.sh
timeout.nix
timeout.sh
undefined-variable.nix
user-envs.builder.sh
user-envs.nix
user-envs.sh Add some tests for nix-env -q --json 2022-03-16 21:33:38 +01:00
why-depends.sh Make nix why-depends quieter by default 2022-01-19 14:24:14 +01:00
zstd.sh