Skip to content

CA derivations break nix-collect-garbage #4026

@thufschmitt

Description

@thufschmitt

Describe the bug

If the nix store contains a non realised CA derivation and the keep-derivations is set to true, then running nix collect-garbage will fail with

error: --- Error --- nix-collect-garbage
output 'dev' has no store path mapped to it

Steps To Reproduce

From Nix master (609a6d6), apply the following diff and run make tests/content-addressed.sh.test

diff --git a/tests/content-addressed.sh b/tests/content-addressed.sh
index ae9e3c59e..0ae2852d2 100644
--- a/tests/content-addressed.sh
+++ b/tests/content-addressed.sh
@@ -15,3 +15,6 @@ out1=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 1)
 out2=$(nix-build "${commonArgs[@]}" ./content-addressed.nix --arg seed 2)
 
 test $out1 == $out2
+
+nix-instantiate --experimental-features ca-derivations ./content-addressed.nix -A rootCA --arg seed 5
+nix-collect-garbage --experimental-features ca-derivations --option keep-derivations true

Expected behavior

nix-collect-garbage should succeed (and the test pass)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions