Nix: Unclear how to use nix copy to copy between local stores

Created on 13 Apr 2017  Â·  3Comments  Â·  Source: NixOS/nix

Let's say I have a local store in $PWD/foo, and want to copy something from my host store to it. I try the following:

$ nix copy --to local?root=$PWD/foo $(which ls)
error: cannot add path ‘/nix/store/4d6f8hg5gv20nsbq7b52qzn6bcs4fvlh-coreutils-8.26’ because it lacks a valid signature

Okay, probably a minor bug (my local store isn't signed and probably doesn't need to be). So I try:

$ nix copy --option signed-binary-caches="" --to local?root=$PWD/foo $(which ls)
error: getting status of ‘/home/copumpkin/nixpkgs/local?root=/home/copumpkin/nixpkgs/foo’: No such file or directory

It seems to be interpreting my local?root=... as a file path, which is different from how NIX_REMOTE works. Is there another format I should use to achieve this?

cc @edolstra @dtzWill

Most helpful comment

Oh, no, this works now! You're right, it was just me being stupid about --option again. Which is why I wrote the PR to stop myself being stupid about it 😄

$ nix copy -r --option signed-binary-caches "" --to local?root=$PWD/foo $(which ls)

All 3 comments

--option takes the next two arguments, so you'll want --option signed-binary-caches '*' I think.

Also these options are not actually used until after #1302 was merged, which I don't think is in any repo's nixUnstable yet.

Oh, no, this works now! You're right, it was just me being stupid about --option again. Which is why I wrote the PR to stop myself being stupid about it 😄

$ nix copy -r --option signed-binary-caches "" --to local?root=$PWD/foo $(which ls)

nix copy also has a "--no-check-sigs" flag you can specify.

Was this page helpful?
0 / 5 - 0 ratings