I did something wrong while playing with nix-repl

So, I was playing with Nix REPL:

nix-repl> x = ./.

nix-repl> y = ./.

nix-repl> x + y
/home/pierre/nixos-config/home/pierre/nixos-config

nix-repl> "" + x + y
copying '/home/pierre/nixos-config' to the store"/nix/store/4lxgb8kg3h25aykf7z2cf38g67nnq5zs-nixos-config/nix/store/4lxgb8kg3h25aykf7z2cf38g67nnq5zs-nixos-config"

So, something was added to the store. How can I undo this copy? I don’t know what I’m doing. :cry:

Nix just copied the current directory into the store, you did not break anything. If you want to remove the path from the store, you can run the garbage collector.

1 Like

Why did it so? I don’t understand what is happening.

1 Like

That’s how string interpolation works for path variables. Hopefully this nix manual section will help. Specifically this:

A path in an interpolated expression is first copied into the Nix store, and the resulting string is the store path of the newly created store object.

2 Likes