Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private crate registries #186

Open
LukeMathWalker opened this issue Aug 4, 2021 · 4 comments · May be fixed by #214
Open

Private crate registries #186

LukeMathWalker opened this issue Aug 4, 2021 · 4 comments · May be fixed by #214

Comments

@LukeMathWalker
Copy link

LukeMathWalker commented Aug 4, 2021

Hey!
I am starting to play around with nix to build Rust projects and I am experimenting on a crate that pulls in some dependencies from a private crate registry.
This leads to a failure when doing nix flake check:

Caused by:
       >   no index found for registry: `truelayer-rustlayer`
       > [naersk] cargo returned with exit code 101, exiting

I imagine this is perhaps related to naersk ignoring .cargo/config.toml?

@psionic-k
Copy link

cargo2nix has some private registry support. It may require updating. I'll see if I can pull some examples out of the original creators.

@Anderssorby
Copy link
Collaborator

You can add a config.toml to your naersk build by creating a file at .cargo/config.

cargoconfig =

@Anderssorby
Copy link
Collaborator

But it seems naersk doesn't support this yet. We need to update this

naersk/build.nix

Lines 433 to 449 in aec8bd9

# XXX: the actual crate format is not documented but in practice is a
# gzipped tar; we simply unpack it and introduce a ".cargo-checksum.json"
# file that cargo itself uses to double check the sha256
unpackCrate = name: version: sha256:
let
crate = fetchurl {
url = "https://crates.io/api/v1/crates/${name}/${version}/download";
inherit sha256;
name = "download-${name}-${version}";
};
in
runCommand "unpack-${name}-${version}" {}
''
mkdir -p $out
tar -xzf ${crate} -C $out
echo '{"package":"${sha256}","files":{}}' > $out/${name}-${version}/.cargo-checksum.json
'';

@Anderssorby Anderssorby linked a pull request Dec 8, 2021 that will close this issue
@secana
Copy link

secana commented Feb 22, 2024

I ran into the same issue. Would be great if naersk respects config.toml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants