Passing credentials to nix-prefetch-docker

How do I pass credentials to nix-prefetch-docker?

I need to pull images from a registry which requires a login so I ran skopeo login which created ~/.docker/config.json. nix-prefetch-docker ignores that file and I get an authentication error. I have to run skopeo copy then nix-store --add-fixed to pull the images.

From what I can see in https://github.com/NixOS/nixpkgs/blob/a3ca1528d74a3892576bf46bcd48d890ad380c58/pkgs/build-support/docker/nix-prefetch-docker, prefetch docker uses skopeo, so it should pick up your creds.

That is true, but the wrapper script https://github.com/NixOS/nixpkgs/blob/cd34bf3e29170b672ef2195735243a1d4e88c89e/pkgs/build-support/docker/nix-prefetch-docker.nix#L16 does this --set HOME /homeless-shelter.

1 Like

So the workaround that I now use is to basically “unwrap” the script in order to skip the resetting of the HOME variable and call .nix-prefetch-docker-wrapped directrly.