[Nix-dev] Problem compiling a rust program without fetchFromGitHub

Christian Kauhaus kc at flyingcircus.io
Tue Mar 21 16:30:58 CET 2017


Hello fellow Nixers,

I recently failed to compile a Rust program (rustfmt) from a local checkout. Compiling with identical sources obtained via fetchFromGitHub succeeded. Compiling from a identical local checkout didn't. Very strange. Can anyone help me to figure out what is going wrong?

This is what happened:

* I use pkgs.rustPlatform.buildRustPackage from the latest 17.03beta542.

* This code works:

```
pkgs.rustPlatform.buildRustPackage rec {
  name = "my-rustfmt";
  src = pkgs.fetchFromGitHub {
    owner = "rust-lang-nursery";
    repo = "rustfmt";
    rev = "907134c2d10c0f11608dc4820b023f8040ad655a";
    sha256 = "1sn590x6x93wjzkb78akqjim734hxynck3gmp8fx7gcrk5cch9mc";
  };
  depsSha256 = "1djpzgchl93radi52m89sjk2nbl9f4y15pwn4x78lqas0jlc6nlr";
}
```

* When I clone the repo into the local filesystem, the build fails. New code:

```
pkgs.rustPlatform.buildRustPackage rec {
  name = "my-rustfmt";
  src = ./rustfmt;
  depsSha256 = "1djpzgchl93radi52m89sjk2nbl9f4y15pwn4x78lqas0jlc6nlr";
}
```

I tried it with and without a .git directory present. No difference.

The relevant output lines of the failing case are:

| Using cargo deps from /nix/store/7v30ck1i3c1l2j2g461ld3jaq3hvfg01-my-rustfmt-fetch
| Using indexHash '-ba82b75dd6681d6f'
| Using rust registry from /nix/store/gv06zlhm4rnhi7j9s1sjj4njns3ca788-rustRegistry-2017-02-19-d822c58
| warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future
| error: failed to load source for a dependency on `syntex_syntax`
| 
| Caused by:
|   Unable to update registry file:///dev/null
| 
| Caused by:
|   failed to open: /tmp/nix-build-my-rustfmt.drv-0/deps/registry/index/-ba82b75dd6681d6f/.cargo-index-lock

The full logs are attached.

I believe that both attempts should result in identical builds. Did I do something wrong? Is this a bug?

TIA

Christian

-- 
Dipl-Inf. Christian Kauhaus <>< · kc at flyingcircus.io · +49 345 219401-0
Flying Circus Internet Operations GmbH · http://flyingcircus.io
Forsterstraße 29 · 06112 Halle (Saale) · Deutschland
HR Stendal 21169 · Geschäftsführer: Christian Theune, Christian Zagrodnick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fails-with-local-checkout.log
Type: text/x-log
Size: 1132 bytes
Desc: not available
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170321/c7e852f1/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: works-with-fetchFromGitHub.log
Type: text/x-log
Size: 7597 bytes
Desc: not available
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170321/c7e852f1/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170321/c7e852f1/attachment-0001.sig>


More information about the nix-dev mailing list