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

(rustc, cargo): (1.17.0, 0.18.0) -> (1.19.0, 0.20.0) #28459

Closed
wants to merge 1 commit into from

Conversation

loskutov
Copy link
Contributor

Motivation for this change

Update Rust and Cargo to up-to-date versions

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@grahamc
Copy link
Member

grahamc commented Aug 24, 2017

I've started trying to compile this change.

@grahamc
Copy link
Member

grahamc commented Aug 24, 2017

Builds fine!

@MP2E
Copy link

MP2E commented Aug 25, 2017

Tested on x86_64 NixOS on my end, Rust and Cargo build just fine but if I try to build ripgrep or other rust packages with it using nix I get the following error:

building path(s) ‘/nix/store/ip40a32hp1mx5vd3qi79a13hcphkx0qy-ripgrep-0.6.0’                                                                                             
unpacking sources                                                                                                                                                        
unpacking source archive /nix/store/1s01kdhzmrpa97051k0s7b53230bknk4-ripgrep-0.6.0-src                                                                                   
source root is ripgrep-0.6.0-src                                                                                                                                         
Using cargo deps from /nix/store/9vqyrlz7qji6q9jb07wpbdwdi56vn26f-ripgrep-0.6.0-fetch                                                                                    
Using indexHash '-ba82b75dd6681d6f'                                                                                                                                      
Using rust registry from /nix/store/2chf0n5c4mdb6m82ym7wh1wyqdp8vdgw-rustRegistry-2017-08-24                                                                             
warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future                                 
error: failed to open: /tmp/nix-build-ripgrep-0.6.0.drv-0/deps/registry/index/-ba82b75dd6681d6f/.cargo-index-lock                                                        
                                                                                                                                                                         
Caused by:                                                                                                                                                               
  Permission denied (os error 13)                                                                                                                                        
builder for ‘/nix/store/w2340z8llwwbf0xm7zrinpij4sh2n36w-ripgrep-0.6.0.drv’ failed with exit code 101                                                                    
error: build of ‘/nix/store/w2340z8llwwbf0xm7zrinpij4sh2n36w-ripgrep-0.6.0.drv’ failed

@Ma27
Copy link
Member

Ma27 commented Aug 25, 2017

nice! will test it tonight :)

@Ma27
Copy link
Member

Ma27 commented Aug 26, 2017

it builds successfully on 17.09pre112899.129f8d7e99 (Hummingbird), but I can confirm the issue reported by @MP2E

@loskutov
Copy link
Contributor Author

Well, reproducible builds is one of the things we all love nix for :)
Anyway, I have no idea yet why .cargo-index-lock appears to be inaccessible :/

@Ma27 Ma27 mentioned this pull request Aug 27, 2017
@globin globin added the 2.status: work-in-progress This PR isn't done label Aug 27, 2017
@vitiral
Copy link
Contributor

vitiral commented Sep 5, 2017

might as well do rustc to 1.20 at this point, since that was announced a few days ago

@loskutov
Copy link
Contributor Author

loskutov commented Sep 5, 2017

I've already tried it, but it doesn't even build out-of-box for me. Given I still haven't fixed the issue reported by @MP2E, I think it has the priority for now.

@LnL7 LnL7 added 6.topic: rust 8.has: package (update) This PR updates a package to a newer version labels Sep 15, 2017
@greglearns
Copy link

For what it's worth, I was able to build using 1.18 and 1.19, but when I tried 1.19 and 1.20, I got an error in the Rust test suite (running on Mac OSX 10.12.6): "error: verification with 'FileCheck' failed" (related to rust-lang/rust#37945).

@akru
Copy link
Contributor

akru commented Sep 22, 2017

Hi! I was upgrade rust to 1.20, cargo to 0.21.1 in airalab@39efddb
May it be helpful.

@bachp
Copy link
Member

bachp commented Sep 22, 2017

I also get the same error as mentioned by @MP2E .

I'm currently looking at rust-lang/cargo#2857 and rust-lang/cargo#2811 to see if I can improve the whole cargo fetch procedure.

This should also get rid of the warning we currently see:

warning: custom registry support via the `registry.index` configuration is being removed, this functionality will not work in the future

@datakurre
Copy link
Contributor

@loskutov .cargo-index-lock is inaccessible, because its parent directory has been symlinked from read-only nix store. Maybe the previous cargo did not create that lock file. I tried copying rustRegistry intead of symlinking, but got another errors related to registry.index....

@akru Are you able also to buildRustPackages with your rust 1.20 an cargo 0.21.1 without the error mentioned in @MP2E? I see you pointed rustRegistry directly to nix store and commented out a lot of lines.

@datakurre
Copy link
Contributor

@akru I tried your branch, and buildRustPackage worked, but only with sandboxing disabled.

@akru
Copy link
Contributor

akru commented Sep 24, 2017

@datakurre Yup, in my opinion the evil in changed behaviour of cargo from v0.19. In my view helper script based on the assumption that cargo don't update the registry with cached value already exist. But new cargo try to update registry at all. I look forward to resolving this issue with sandbox.

@mguentner
Copy link
Contributor

A lot of current crates are not usable because the rust version is just too old. I am using the mozilla overlay in the meantime, however this only works for development.
Is someone working on a fix?

@dywedir
Copy link
Member

dywedir commented Sep 28, 2017

@mguentner part of my nixpkgs.overlays may be interesting for you:

  nixpkgs.overlays = [
    (import /path/to/nixpkgs-mozilla)
    (self: super: {
      pijul = super.callPackage "${nix_store}/pijul.nix" { 
        rustPlatform = super.recurseIntoAttrs (super.makeRustPlatform {
          rustc = self.latest.rustChannels.stable.rust;
          inherit cargo;
        });
      };
      
      rustfmt-nightly = super.callPackage "${nix_store}/rustfmt-nightly.nix" { 
        rustPlatform = super.recurseIntoAttrs (super.makeRustPlatform {
          rustc = (self.rustChannelOf { date = "2017-09-20"; channel = "nightly"; }).rust;
          inherit cargo;
        });
      };
    })
  ];

@mguentner
Copy link
Contributor

Thank you. How do you handle the out-of-date cargo registry?

@dywedir
Copy link
Member

dywedir commented Sep 28, 2017

Forgot to include this:

   # ...
      rustRegistry = super.callPackage "${nix_store}/rust-packages.nix" { };
   # ...

I'd like to write an automatic updater for rustRegistry :)

@greglearns
Copy link

greglearns commented Sep 28, 2017

@dywedir I've been struggling with how all of the pieces of Rust Nightly + Nix work together -- can you share a full default.nix example for compiling a Rust Nightly app? And, does your solution only work if you are using NixOS? (I'm running NixPkgs on Macosx and using NixOps to deploy to AWS, so I'm hoping your solution works for both mac and nixos.)

@dywedir
Copy link
Member

dywedir commented Sep 29, 2017

@greglearns this definitely works for nixpkgs. You need three points:

(both in ~/.config/nixpkgs/overlays for nixpkgs case. You can do it in each default.nix instead, if you wish)

  • typical default.nix for rust package

I.e. rustfmt-nightly/default.nix (named rustfmt-nightly.nix above):

{ stdenv, fetchFromGitHub, rustPlatform }:

rustPlatform.buildRustPackage rec {
  name = "rustfmt-nightly-${version}";
  version = "0.2.7";

  src = fetchFromGitHub {
    owner = "rust-lang-nursery";
    repo = "rustfmt";
    rev = "nightly-${version}";
    sha256 = "0xqjdq8g40nkqfrkzl9sj5fq5kqf09gp65zxy8dli4b1ic81lfs3";
  };

  depsSha256 = "0yniynv74v6amvjgiba9lczmshp9sl6qdm9qbblfw782hrkif10x";

  meta = with stdenv.lib; {
    description = "A tool for formatting Rust code according to style guidelines";
    homepage = https://github.com/rust-lang-nursery/rustfmt;
    license = with licenses; [ mit /* or */ asl20 ];
    maintainers = with maintainers; [ dywedir ];
    platforms = platforms.all;
  };
}

@andir
Copy link
Member

andir commented Oct 5, 2017

There is a PR for rust 1.20.0 (#30088) so this can probably be closed?

@Mic92 Mic92 closed this Oct 5, 2017
@mguentner mguentner mentioned this pull request Oct 5, 2017
17 tasks
@rlupton20
Copy link
Contributor

@dywedir your rustPlatform override snippet is really useful. Would it be ok to add this to the nixpkgs manual (specifically the part on using the mozilla overlays)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: work-in-progress This PR isn't done 6.topic: rust 8.has: package (update) This PR updates a package to a newer version
Projects
None yet
Development

Successfully merging this pull request may close these issues.