Code Monkey home page Code Monkey logo

rust-overlay's Introduction

rust-overlay

CI status sync-channels status

Pure and reproducible packaging of binary distributed rust toolchains. A compatible but better replacement for rust overlay of nixpkgs-mozilla, with also non-overlay and Nix Flake interfaces (despite the project name).

For migration from nixpkgs-mozilla, see this section.

Features:

  • Hashes of toolchain components are pre-fetched in tree, so the evaluation is pure and no need to have network access.

  • These hashes are auto-updated daily using GitHub Actions.

  • Current oldest supported version is stable 1.29.0 and beta/nightly 2018-09-13 (which are randomly picked and may change over time).

  • We targets nixos-unstable and supported releases of NixOS, on x86_64-linux. They are tested on CI. Other platforms and nixpkgs channels may also work but is not guaranteed.

Documentations:

Installation

Classic Nix overlay

You can put the code below into your ~/.config/nixpkgs/overlays.nix.

[ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ]

Then the provided attribute paths are available in nix command.

$ nix-env -iA nixpkgs.rust-bin.stable.latest.default # `nixpkgs` (or `nixos`) is your nixpkgs channel name.

Alternatively, you can install it into nix channels.

$ nix-channel --add https://github.com/oxalica/rust-overlay/archive/master.tar.gz rust-overlay
$ nix-channel --update

And then feel free to use it anywhere like import <nixpkgs> { overlays = [ (import <rust-overlay>) ]; } in your nix shell environment.

Nix Flakes

Warning: Only the output overlay/overlays are currently stable. Use other outputs at your own risk!

For a quick play, just use nix shell to bring the latest stable rust toolchain into scope. (All commands below requires preview version of Nix with flake support.)

$ nix shell github:oxalica/rust-overlay
$ rustc --version # This is only an example. You may get a newer version here.
rustc 1.49.0 (e1884a8e3 2020-12-29)
$ cargo --version
cargo 1.49.0 (d00d64df9 2020-12-05)

Use in NixOS Configuration

Here's an example of using it in nixos configuration.

{
  description = "My configuration";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, rust-overlay, ... }: {
    nixosConfigurations = {
      hostname = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          ./configuration.nix # Your system configuration.
          ({ pkgs, ... }: {
            nixpkgs.overlays = [ rust-overlay.overlays.default ];
            environment.systemPackages = [ pkgs.rust-bin.stable.latest.default ];
          })
        ];
      };
    };
  };
}

Use in devShell for nix develop

Running nix develop will create a shell with the default beta Rust toolchain installed:

{
  description = "A devShell example";

  inputs = {
    nixpkgs.url      = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    flake-utils.url  = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlays = [ (import rust-overlay) ];
        pkgs = import nixpkgs {
          inherit system overlays;
        };
      in
      {
        devShells.default = with pkgs; mkShell {
          buildInputs = [
            openssl
            pkg-config
            eza
            fd
            rust-bin.beta.latest.default
          ];

          shellHook = ''
            alias ls=eza
            alias find=fd
          '';
        };
      }
    );
}

Migration from nixpkgs-mozilla

  1. Change the channel URL to https://github.com/oxalica/rust-overlay/archive/master.tar.gz, or flake URL to github:oxalica/rust-overlay for Nix Flakes.
  2. Good to go! latest.*, rustChannel*.* and friends are made compatible with nixpkgs-mozilla. You don't necessary need to change anything.
  3. You can also optionally change to the rust-bin interface, which provides more functionality like "latest nightly with specific components available" or "from rust-toolchain file". It also has nix-aware cross-compilation support.

Cheat sheet: common usage of rust-bin

  • Latest stable or beta rust profile.

    rust-bin.stable.latest.default # Stable rust, default profile. If not sure, always choose this.
    rust-bin.beta.latest.default   # Wanna test beta compiler.
    rust-bin.stable.latest.minimal # I don't need anything other than rustc, cargo, rust-std. Bye rustfmt, clippy, etc.
    rust-bin.beta.latest.minimal

    It provides the same components as which installed by rustup install's default or minimal profiles.

    Almost always, default is what you want for development.

    Note: For difference between default and minimal profiles, see rustup - Profiles

  • Latest stable or beta rust profile, with extra components or target support.

    rust-bin.stable.latest.default.override {
      extensions = [ "rust-src" ];
      targets = [ "arm-unknown-linux-gnueabihf" ];
    }
  • Latest nightly rust profile.

    rust-bin.selectLatestNightlyWith (toolchain: toolchain.default) # or `toolchain.minimal`

    Note: Don't use rust-bin.nightly.latest. Your build would fail when some components missing on some days. Always use selectLatestNightlyWith instead.

  • Latest nightly rust profile, with extra components or target support.

    rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
      extensions = [ "rust-src" ];
      targets = [ "arm-unknown-linux-gnueabihf" ];
    })
  • A specific version of rust:

    rust-bin.stable."1.48.0".default
    rust-bin.beta."2021-01-01".default
    rust-bin.nightly."2020-12-31".default

    Note: All of them are override-able like examples above.

  • If you already have a rust-toolchain file for rustup, you can simply use fromRustupToolchainFile to get the customized toolchain derivation.

    rust-bin.fromRustupToolchainFile ./rust-toolchain
  • Toolchain with specific rustc git revision.

    This is useful for development of rust components like MIRI, which requires a specific revision of rust.

    rust-bin.fromRustcRev {
      rev = "a2cd91ceb0f156cb442d75e12dc77c3d064cdde4";
      components = {
        rustc = "sha256-x+OkPVStX00AiC3GupIdGzWluIK1BnI4ZCBbg72+ZuI=";
        rust-src = "sha256-13PpzzYtd769Xkb0QzHpNfYCOnLMWFolc9QyYq98z2k=";
      };
    }

    Warning: This may not always work (including the example below) since upstream CI periodically purges old artifacts.

  • There also an cross-compilation example in examples/cross-aarch64.

License

MIT licensed.

rust-overlay's People

Contributors

2gn avatar abbec avatar actions-user avatar atcol avatar bbigras avatar clot27 avatar fetsorn avatar iogamaster avatar j-baker avatar jost-s avatar mikroskeem avatar mplanchard avatar oxalica avatar pandapip1 avatar rexcrazy804 avatar sbellem avatar supersamus avatar vergedx avatar wackbyte avatar zhaofengli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-overlay's Issues

Allow usage as a package set

nixpkgs-mozilla exposes a package set here which allows it to be used for things like this. Is this something that already exists or can be supported? I'd love to be able to build my custom packages with the same toolchain I use across the rest of my machine.

2022-02-17 nightly fails to build

Using the default profile the autoPatchelfHook fails due to missing libstdc++6 in nixpkgs, I can get a build log in some time if required.

How to access documentation

In a rustup installation the local documentation can be opened via:

$ rustup doc

The overlayโ€™s package also includes this documentation but itโ€™s not clear to me how itโ€™s intended to be found. For now Iโ€™ve exposed it via an ad hoc script:

pkgs.writeShellScriptBin "rust-doc" ''
  xdg-open '${pkgs.rust-bin.stable.latest.default}/share/doc/rust/html/index.html'
''

Is this the way to go or am I missing something?

Doesn't recognize channel "1.54"

https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification says

<channel> = stable|beta|nightly|<major.minor>|<major.minor.patch>

So 1.54 should be a valid channel. It's used in https://github.com/cloudflare/wrangler/blob/090f638fe37c5fd9775d27bb23a1445cd8fbabc9/rust-toolchain#L2

However, rust-overlay doesn't seem to recognize it:

$ nix repl
Welcome to Nix version 2.3.12. Type :? for help.

nix-repl> rustOverlay = import (builtins.fetchTarball {
                        url = "https://github.com/oxalica/rust-overlay/archive/3a29d5e726b855d9463eb5dfe04f1ec14d413289.tar.gz";
                        sha256 = "036w70r22dhwmlq43mf7pwa33ky159brvg2dw1pbqh5j06817yvx";
                      })

nix-repl> rustVersionOverlay = (self: super:
              let
                rustChannel = super.rust-bin.fromRustupToolchain { channel = "1.54"; };
              in
              {
                rustc = rustChannel;
                cargo = rustChannel;
              }
            )

nix-repl> pkgs = import <nixpkgs> { overlays=[rustOverlay rustVersionOverlay]; }

nix-repl> pkgs.rustc
error: Unknown channel: 1.54

nix-repl> 

Using 1.54.0 works, but I'm trying to build released software, with their toolchain file.

Host component `rust-docs` doesn't support target `aarch64-apple-darwin`

Hey,

I wanted to use your overlay and it seems, that it's not fully ready for aarch64-apple-darwin.

-> % home-manager build
error: Component resolution failed for rust-default-1.55.0
       - note: available extensions are cargo, clippy, clippy-preview, llvm-tools-preview, miri, miri-preview, reproducible-artifacts, rls, rls-preview, rust-analysis, rust-analyzer-preview, rust-docs, rust-mingw, rust-src, rust-std, rustc, rustc-dev, rustc-docs, rustfmt, rustfmt-preview
       - Host component `rust-docs` doesn't support target `aarch64-apple-darwin`
(use '--show-trace' to show detailed location information)
-> % uname -a
Darwin Nikolas-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64 arm64 MacBookPro17,1 Darwin

Snip from my home manager.

{ lib, config, pkgs, ... }:

let
  oxalica-overlays = import (builtins.fetchTarball {
    url = https://github.com/oxalica/rust-overlay/archive/master.tar.gz;
  });
in
{
  nixpkgs.overlays = [ oxalica-overlays ];

  home.packages = with pkgs; [
    (rust-bin.stable.latest.default.override {
      extensions = [ "rustc" ];
      targets = [ "wasm32-unknown-unknown" ];
    })

Example of exposing multiple rust toolchains from flake

Often as a crate author I'd like to be able to develop against multiple toolchains locally and run tests against them in CI builds. For example I usually check the following in CI:

  • a pinned "minimum supported rust version"
  • the latest stable
  • the latest beta (to be a good citizen, staying aware of potential regressions in beta)
  • the latest nightly (to keep on top of future updates)

I'm not exactly sure how to do this using the current Rust overlay. It would be really neat to see an example of this in the repository (I went looking but couldn't find one). Here's an example from actions-rs of something similar.

A flake example of picking nightly components would be great

(Sorry nixos noob here) The selectLatestNightlyWith seems excellent, but I'm not quite sure how to call it. I tried this:

        buildInputs = [
            pkgs.openssl
            pkgs.pkgconfig
            pkgs.exa
            pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
              extensions = [ "llvm-tools-preview" ];
            })
          ];

but it's saying function can't be string (I did say I was a noob!). It would be great to have an example usage as there's not currently one on the internet yet and it feel to me that this would be the best default nightly flake template for people to use.

List of default/all available extensions

Thanks for the overlay! Loving the flake dev experience with it.

Two questions:

  • What are the default extensions that come with rust-bin?
  • How can I see which extensions are available for my platform/targets?

I see two comments in rust-overlay.nix which seem to suggest the same default set:

# The packages available usually are:
# cargo, rust-analysis, rust-docs, rust-src, rust-std, rustc, and
# rust, which aggregates them in one package.
#
# For each package the following options are available:
# extensions - The extensions that should be installed for the package.
# For example, install the package rust and add the extension rust-src.
# targets - The package will always be installed for the host system, but with this option
# extra targets can be specified, e.g. "mips-unknown-linux-musl". The target
# will only apply to components of the package that support being installed for
# a different architecture. For example, the rust package will install rust-std
# for the host system and the targets.
# targetExtensions - If you want to force extensions to be installed for the given targets, this is your option.
# All extensions in this list will be installed for the target architectures.
# *Attention* If you want to install an extension like rust-src, that has no fixed architecture (arch *),
# you will need to specify this extension in the extensions options or it will not be installed!

# For each channel:
# rust-bin.stable.latest.cargo
# rust-bin.stable.latest.rust # Aggregate all others. (recommended)
# rust-bin.stable.latest.rustc
# rust-bin.stable.latest.rust-analysis
# rust-bin.stable.latest.rust-docs
# rust-bin.stable.latest.rust-src
# rust-bin.stable.latest.rust-std

Both those comments mention rust-src though, which I find that I need to manually specify via .override in order for rust-analyzer to find it:

pkgs.rust-bin.nightly.latest.rust.override {
  extensions = [ "rust-src" ];
};

I see that the toolchain is generated from the various manifest files (I'm currently using the 02-06 nightly so I assume it's using this manifest) but I don't understand how to interpret that.

I also see these lines which appear to be the list of all available extensions:

# Extensions for mixed `rust` pkg.
components = [
"rustc"
"rust-std"
"cargo"
];
singleTargetExtensions = [
"clippy-preview"
"miri-preview"
"rls-preview"
"rust-analyzer-preview"
"rustfmt-preview"
"llvm-tools-preview"
"rust-analysis"
];
multiTargetExtensions = [
"rust-std"
"rustc-dev"
"rustc-docs"
"rust-src" # This has only one special target `*`
];

When I try to add rustfmt-preview I get the following error:

> nix develop
While compiling rust: the extension rustfmt-preview is not available.
Select extensions from the following list:
clippy-preview
rust-analyzer-preview
llvm-tools-preview
rust-analysis
rust-std
rustc-dev
rustc-docs
rust-src

Is that expected on macOS or is there something I'm doing wrong here?

Configuration wasm32-unknown-wasi not supported

I'm trying to follow the cross compilation example for wasm32-wasi, and get the following when running nix-shell:

*** Configuration wasm32-unknown-wasi not supported
make[1]: *** [Makefile:4332: configure-gcc] Error 1
make[1]: Leaving directory '/build/build'
make: *** [Makefile:956: all] Error 2
error: builder for '/nix/store/3q38zwcxbzkz8l3xa390fg21s1c6qw78-wasm32-wasi-stage-final-gcc-debug-10.3.0.drv' failed with exit code 2;
       last 10 log lines:
       > checking whether times is declared... yes
       > checking whether sigaltstack is declared... yes
       > checking for struct tms... yes
       > checking for clock_t... yes
       > checking for F_SETLKW... yes
       > checking if mkdir takes one argument... no
       > *** Configuration wasm32-unknown-wasi not supported
       > make[1]: *** [Makefile:4332: configure-gcc] Error 1
       > make[1]: Leaving directory '/build/build'
       > make: *** [Makefile:956: all] Error 2
       For full logs, run 'nix log /nix/store/3q38zwcxbzkz8l3xa390fg21s1c6qw78-wasm32-wasi-stage-final-gcc-debug-10.3.0.drv'.
error: 1 dependencies of derivation '/nix/store/jl9q2c2iih8gvw6l5ccw2gww97bqxsvi-rustc-1.58.1-x86_64-unknown-linux-gnu.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jxkalmd4b3j5vr1lcj0nvawj6qwggdvk-rust-minimal-1.58.1.drv' failed to build
error: build of '/nix/store/5zql8f3mnv53qss2v6w9dwbh5ajrrgrj-stdenv-linux.drv', '/nix/store/jxkalmd4b3j5vr1lcj0nvawj6qwggdvk-rust-minimal-1.58.1.drv' failed

I've tried a few things, such as:

  • changing the nixpkgs import, to the commit oxalica/nixpkgs@d96fe72
  • change the config to "wasm32-unknown-wasi" (instead of wasm32-wasi)
  • use nixpkgs-unstable
  • use a rust nightly toolchain

Instructions on obtaining the linker for cross-compilation to Windows?

Oooh, a near-empty issue tracker, time for me to dump my problems in it!

On a more serious note... Thank you for taking the time to bring some improvements to the Nix/Rust ecosystem.

I'm having significant difficulty getting cross-compilation to Windows to work. Here's my shell.nix file:

let 

  pkgs = import <nixpkgs> {
    overlays = [
      (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
    ];
  };

  chan = (pkgs.rustChannelOf {
    date = "2021-01-15";
    channel = "nightly";
  }).rust.override {
    targets = [ "x86_64-pc-windows-gnu" ];
    extensions = [
      "rust-src"
      "rustc-dev"
    ];
  };

in 
    pkgs.mkShell {
        buildInputs = with pkgs; [
            chan
        ];
    }

My code seems to compile fine, but cargo can't find the linker:

error: linker `x86_64-w64-mingw32-gcc` not found
  |
  = note: No such file or directory (os error 2)

I understand I need to bring the mingw linker into the build environment somehow, but so far am running into nothing but arcane errors and compilation failures, even when trying the various apparent solutions floating around on the Internet.

Since you seem to be more familiar with the combination of Rust and Nix than me (I'm a bit of a Nix noob still...), can you offer any advice? I also think that adding some instructions along those lines to the readme would be invaluable to people who are in my situation.

Rust-overlay seem to confuse $NIX_LDFLAGS when cross-compiling?

I have an issue that I cannot quite make sense of. We updated this overlay from 0bcf4e7 to be2d768 and that changed the content in $NIX_LDFLAGS somehow?

0bcf4e7:

echo $NIX_LDFLAGS
-L/nix/store/r5y3drh0fdgmjyibgs6gxqvv457v5vwr-mcfgthreads-git-x86_64-w64-mingw32/lib -L/nix/store/glghra1n3r22zpbnfq6pgizn0zy02rdl-pthreads-w32-2.9.1-x86_64-w64-mingw32/lib

be2d768:

 echo $NIX_LDFLAGS
-liconv -L/nix/store/1wv35rsgcrwjz4jnqs3kq77k6d3qagaf-libc++-7.1.0/lib -L/nix/store/1wv35rsgcrwjz4jnqs3kq77k6d3qagaf-libc++-7.1.0/lib -L/nix/store/wahi8q1ybh9n805zbavs6ch4i8mfpzgy-libc++abi-7.1.0/lib -L/nix/store/wahi8q1ybh9n805zbavs6ch4i8mfpzgy-libc++abi-7.1.0/lib -L/nix/store/6bw7mnz3yp2bk2qvq4xi7vj0xz0h63mm-compiler-rt-7.1.0/lib -L/nix/store/6bw7mnz3yp2bk2qvq4xi7vj0xz0h63mm-compiler-rt-7.1.0/lib -L/nix/store/2jlggnhkjnpw938ak2w6rljlak8dzjbz-libiconv-osx-10.12.6/lib -L/nix/store/2jlggnhkjnpw938ak2w6rljlak8dzjbz-libiconv-osx-10.12.6/lib -L/nix/store/r5y3drh0fdgmjyibgs6gxqvv457v5vwr-mcfgthreads-git-x86_64-w64-mingw32/lib -L/nix/store/r5y3drh0fdgmjyibgs6gxqvv457v5vwr-mcfgthreads-git-x86_64-w64-mingw32/lib -L/nix/store/glghra1n3r22zpbnfq6pgizn0zy02rdl-pthreads-w32-2.9.1-x86_64-w64-mingw32/lib -L/nix/store/glghra1n3r22zpbnfq6pgizn0zy02rdl-pthreads-w32-2.9.1-x86_64-w64-mingw32/lib

The latter erroneously contains build platform dependencies. How can this overlay change that?

Missing `zlib.so.1` error after commit `1fd2dc01ee34817858261bebae6a79cb9debc1f9`

First, thanks for the great project, I've been using it for months without any issue =]

That said, I've been having trouble updating after commit 1fd2dc0 because zlib.so.1 can't be found.

Steps to reproduce the issue:

$ git clone https://github.com/luizirber/decoct 
$ git checkout 405cdb341b8dc8cfb1ad1a44e3205c2efbff6934
$ nix-shell  # works
$ niv update rust-overlay -r 1fd2dc01ee34817858261bebae6a79cb9debc1f9
$ nix-shell  # fails, missing zlib.so.1
Full log:
these derivations will be built:                                                                                                                                                      
  /nix/store/clrf4gcpc3aq3d4ypyivcyd84a02bnmp-rust-1.56.1-x86_64-unknown-linux-gnu.drv
  /nix/store/rsvxlmrqsgr4m1zxd4zsyhw4d87hd36d-rust-legacy-1.56.1.drv
building '/nix/store/clrf4gcpc3aq3d4ypyivcyd84a02bnmp-rust-1.56.1-x86_64-unknown-linux-gnu.drv'...
unpacking sources
unpacking source archive /nix/store/np4qhsdd77fr68v9g1ym6bmlch38d4ji-rust-1.56.1-x86_64-unknown-linux-gnu.tar.xz
source root is rust-1.56.1-x86_64-unknown-linux-gnu
setting SOURCE_DATE_EPOCH to timestamp 1635755669 of file rust-1.56.1-x86_64-unknown-linux-gnu/version
patching sources
installing
Installing component rustc
Installing component rust-std-x86_64-unknown-linux-gnu
Installing component rust-docs
Installing component rust-demangler-preview
Installing component cargo
Installing component rustfmt-preview
Installing component rls-preview
Installing component llvm-tools-preview
Installing component clippy-preview
Installing component rust-analysis-x86_64-unknown-linux-gnu
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/libexec/cargo-credential-1password
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-lld
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-dis
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-as
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld64
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llc
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-strip
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/opt
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-llvm-dwp
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-readobj
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-ar
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo-clippy
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustdoc                                                                                 [70/344]
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustc
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/clippy-driver
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rust-demangler
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rls
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo-fmt
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustfmt
shrinking /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo
gzipping man pages under /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/share/man/
patching script interpreter paths in /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu
/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rust-lldb: interpreter directive changed from "#!/bin/sh" to "/nix/store/l0wlqpbsvh1pgvhcdhw7qkka3d31si7k-
bash-5.1-p8/bin/sh"
/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rust-gdbgui: interpreter directive changed from "#!/bin/sh" to "/nix/store/l0wlqpbsvh1pgvhcdhw7qkka3d31si7
k-bash-5.1-p8/bin/sh"
/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rust-gdb: interpreter directive changed from "#!/bin/sh" to "/nix/store/l0wlqpbsvh1pgvhcdhw7qkka3d31si7k-b
ash-5.1-p8/bin/sh"
checking for references to /build/ in /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu...
automatically fixing dependencies for ELF files
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/libexec/cargo-credential-1password
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
  libz.so.1 -> not found!
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-lld
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-dis
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-as
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-nm
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld/ld64
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llc
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-strip
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/opt
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/rust-llvm-dwp
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-readobj
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objdump
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-ar
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
  libz.so.1 -> not found!
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
  libLLVM-13-rust-1.56.1-stable.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libLLVM-13-rust-1.56.1-stable.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib:/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.
56.1-x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo-clippy
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustdoc
  libtest-7ddc9ce4941507e1.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/libtest-7ddc9ce4941507e1.so
  librustc_driver-1a7f7f6d0c5586ea.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib:/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib:/ni
x/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustc
  librustc_driver-1a7f7f6d0c5586ea.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib:/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rus
tlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/clippy-driver
  librustc_driver-1a7f7f6d0c5586ea.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib:/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rus
tlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rust-demangler
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rls
  librustc_driver-1a7f7f6d0c5586ea.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/librustc_driver-1a7f7f6d0c5586ea.so
  libstd-65a28bf1738424c0.so -> found: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-65a28bf1738424c0.so
setting RPATH to: /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib:/nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rus
tlib/x86_64-unknown-linux-gnu/lib
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo-fmt
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/rustfmt
searching for dependencies of /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/bin/cargo
autoPatchelfHook could not satisfy dependency libz.so.1 wanted by /nix/store/4yhrxcfpy20lbsnk399s21q75nyn8b63-rust-1.56.1-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/lib
LLVM-13-rust-1.56.1-stable.so
Add the missing dependencies to the build inputs or set autoPatchelfIgnoreMissingDeps=true
builder for '/nix/store/clrf4gcpc3aq3d4ypyivcyd84a02bnmp-rust-1.56.1-x86_64-unknown-linux-gnu.drv' failed with exit code 1
cannot build derivation '/nix/store/rsvxlmrqsgr4m1zxd4zsyhw4d87hd36d-rust-legacy-1.56.1.drv': 1 dependencies couldn't be built
error: build of '/nix/store/rsvxlmrqsgr4m1zxd4zsyhw4d87hd36d-rust-legacy-1.56.1.drv' failed

Clippy on macOS: dyld: Library not loaded: @rpath/librustc_driver-5d5e1e2505841b99.dylib

Clippy throws this error on macOS CI:

>>> "cargo" "clippy" "--all-features" "--all-targets" "--" "-Dwarnings"
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/nix/store/r7lzrrkq759ak62a2sqyhmcsffn9xamp-rust-default-1.57.0/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (signal: 6, SIGABRT: process abort signal)
  --- stderr
  dyld: Library not loaded: @rpath/librustc_driver-5d5e1e2505841b99.dylib
    Referenced from: /nix/store/r7lzrrkq759ak62a2sqyhmcsffn9xamp-rust-default-1.57.0/bin/clippy-driver
    Reason: image not found

rust-overlay commit ID: ad311f5

Link to the failing CI job

unable to replace nixpkgs-mozilla/rust-overlay with rust-overlay/rust-overlay: fails to evaluate

How do I use this to replace mozilla overlay in presence of rustup toolchain file?

If we look at something like crate2nix, it's documented how to use mozilla overlay: https://github.com/kolloch/crate2nix#choosing-a-rust-version

What is done there is we generate the toolchain then override individual components like rustc and such in the nixpkgs.

However, fromRustupToolchainFile only produces a single derivation and individual components don't seem accessible. This is documented at https://discourse.nixos.org/t/rust-overlay-a-better-rust-toolchain-provider-and-drop-in-replacement-of-nixpkgs-mozilla/10986/14

I have something like this

let
  sources = import ./sources.nix;
  rustChannelsOverlay = import sources.rust-overlay;
  # rustChannelsSrcOverlay =
  #   import "${sources.nixpkgs-mozilla}/rust-src-overlay.nix";
in import sources.nixpkgs {
  overlays = [
    rustChannelsOverlay
    # rustChannelsSrcOverlay
    (self: super:
      let rustChannel = self.rust-bin.fromRustupToolchainFile ../rust-toolchain;
      in {
        rustc = rustChannel;
        cargo = rustChannel;
        # rust = rustChannel;
        rust-fmt = rustChannel;
        rust-std = rustChannel;
        clippy = rustChannel;
        # inherit (rustChannel) cargo rust rust-fmt rust-std clippy;
      })
  ];
}

and it kind of seems to be working (I haven't completely verified) but it seems a bit wrong somehow. Also rust attribute doesn't exist so it's probably going to do wrong with if we try to cross-compile or something.

Forks of rustc

How would I go about having rust-overlay build the toolchain from a custom source I choose? I wish to use the Solana fork and it seems the fromRustcRev function isn't really meant for that.

Missing shared library when invoking `cargo objcopy`

Hi folks! I'm working on an embedded project, and so far this overlay has been great for setting up a custom rust installation with the necessary components etc.

However, I've just tried using cargo objcopy -- -O binary for the first time in preparation for flashing my rust program to some embedded hardware and am running into the following error:

1/nix/store/q8kjvbvac54g8q8hmxsp530iv87r47j5-rust-default-1.51.0/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-objcopy: error while loading shared libraries: libLLVM-11-rust-1.51.0-stable.so: cannot open shared object file: No such file or directory

Any idea on what might be going on here?

Going to try switching back to rustup temporarily to see if that still works.

Unable to use nightly rustfmt and stable toolchain together.

{
  description = "dcompass project";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };

  outputs = { nixpkgs, rust-overlay, ... }: {
    devShell."x86_64-linux" = let
      nixpkgs-wrapped = import nixpkgs {
        system = "x86_64-linux";
        overlays = [ rust-overlay.overlay ];
      };
    in with nixpkgs-wrapped;
    mkShell {
      nativeBuildInputs = [
        rust-bin.stable.latest.rust
        (lib.hiPrio (rust-bin.nightly."2021-01-01".rustfmt))
        binutils-unwrapped
      ];
    };
  };
}

gives

[ash@x1c7:~/Documents/git/dcompass]$ rustfmt --version
rustfmt 1.4.25-stable (0f29ff6 2020-11-11)

[ash@x1c7:~/Documents/git/dcompass]$ which rustfmt 
/nix/store/jzx390k8vyp23j0vapg6xdd96ymhjm50-rust-1.49.0/bin/rustfmt

Cross-compilation fails with "target may not be installed", missing std crate for #[no_std] project

I've got the following:

flake.nix
{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-20.09";

    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    naersk = {
      url = "github:nmattia/naersk";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, rust-overlay, naersk }:
    let
      systems = [
        "aarch64-linux"
        "x86_64-linux"
      ];

      eachSystem = systems: f: builtins.foldl' (attrs: system: attrs // { ${system} = f system; }) { } systems;
    in
    {
      packages = eachSystem systems
        (system:
          let
            pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; };
            toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
          in
          {
            fw = (naersk.lib.${system}.override {
              cargo = toolchain;
              rustc = toolchain;
            }).buildPackage {
              src = ./sbs-fw;
            };
          }
        );
    };
}
rust-toolchain
[toolchain]
channel = "nightly-2021-01-27"
components = [ "clippy-preview", "miri-preview", "rls-preview", "rust-analysis", "rust-analyzer-preview", "rustfmt", "llvm-tools-preview", "rust-src", "rust-std" ]
targets = [ "thumbv7m-none-eabi", "x86_64-pc-windows-gnu", "x86_64-unknown-linux-gnu" ]

cargo build in the sbs-fw directory works just fine, however, when doing a nix build .#fw the following error occurs:

sbs-fw-deps>    Compiling stm32f1xx-hal v0.6.1
sbs-fw-deps> error: could not compile `sbs-fw`
sbs-fw-deps> To learn more, run the command again with --verbose.
sbs-fw-deps> warning: build failed, waiting for other jobs to finish...
sbs-fw-deps> error: build failed
sbs-fw-deps> error[E0463]: can't find crate for `std`
sbs-fw-deps>   |
sbs-fw-deps>   = note: the `thumbv7m-none-eabi` target may not be installed
sbs-fw-deps> error: aborting due to previous error
sbs-fw-deps> For more information about this error, try `rustc --explain E0463`.
sbs-fw-deps> [naersk] cargo returned with exit code 101, exiting
error: --- Error --- nix-daemon
builder for '/nix/store/azanh3lgylx1gpcdbbdsqzkjy83hp0kp-sbs-fw-deps-0.1.0.drv' failed with exit code 101; last 10 log lines:
    |
    = note: the `thumbv7m-none-eabi` target may not be installed
  
  
  error: aborting due to previous error
  
  
  For more information about this error, try `rustc --explain E0463`.
  
  [naersk] cargo returned with exit code 101, exiting

I tried adding "rust-std-thumbv7m-none-eabi" to "components" in rust-toolchain, however, rust-overlay complains that's not a valid component. rustup does install it for each target though.

Edit: forgot to mention, this ia a #[no_std] embedded project.
Edit:
The user-installed rustup reports the following components:

$ rustup component list | rg installed
cargo-x86_64-unknown-linux-gnu (installed)
clippy-x86_64-unknown-linux-gnu (installed)
llvm-tools-preview-x86_64-unknown-linux-gnu (installed)
miri-x86_64-unknown-linux-gnu (installed)
rls-x86_64-unknown-linux-gnu (installed)
rust-analysis-x86_64-unknown-linux-gnu (installed)
rust-analyzer-preview-x86_64-unknown-linux-gnu (installed)
rust-docs-x86_64-unknown-linux-gnu (installed)
rust-src (installed)
rust-std-thumbv7m-none-eabi (installed)
rust-std-x86_64-pc-windows-gnu (installed)
rust-std-x86_64-unknown-linux-gnu (installed)
rustc-x86_64-unknown-linux-gnu (installed)
rustfmt-x86_64-unknown-linux-gnu (installed)

clippy crashes

I am using rust-overlay on c2d1394.
Toolchain is added to my nix-shell buildInputs as rust-bin.fromRustupToolchainFile ../rust-toolchain.toml where rust-toolchain.toml is:

[toolchain]
channel = "stable"
components = [ "rustfmt" "clippy" ]
profile = "default"

cargo build works correctly but cargo clippy fails with the following error:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/nix/store/5jfffagi38mwggzphsfj8vgy0vr3lxkm-rust-default-1.51.0/bin/clippy-driver rustc - --crate-name ___ --print=file-names --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (signal: 6, SIGABRT: process abort signal)
  --- stderr
  dyld: Library not loaded: @rpath/librustc_driver-7037e29e292ceb50.dylib
    Referenced from: /nix/store/5jfffagi38mwggzphsfj8vgy0vr3lxkm-rust-default-1.51.0/bin/clippy-driver
    Reason: image not found

Linking fails on macOS: framework not found

We're using rust-overlay in our project ragenix together with naersk. A recent flake update fails to link on macOS with the following error:

ragenix> error: could not compile `ragenix` due to 2 previous errors
ragenix> error: linking with `cc` failed: exit status: 1
[...]
ragenix>   = note: ld: framework not found Security
ragenix>           collect2: error: ld returned 1 exit status
ragenix>
ragenix> error: aborting due to previous error

The full log is available in the CI run of the PR: https://github.com/yaxitech/ragenix/pull/24/checks?check_run_id=3643619398. Building on Linux works fine.

I have pinpointed c7ed82b to introduce the error. I'm not too familiar with the internals; therefore, I cannot tell why this commit makes a difference. Do we have to adapt our flake?

I'd appreciate if you could look into this. Thanks!

rustfmt preview is not installed

Hey,

I have in my home-manager

    (pkgs.rust-bin.stable.latest.default.override {
      targets = [ "x86_64-apple-darwin" ];
      targetExtensions = [ "rust-docs" ];
      extensions = [ "rustfmt-preview" ];
    })

    (pkgs.rust-bin.stable.latest.default.override {
      targets = [ "wasm32-unknown-unknown" ];
      extensions = [ "rust-std" ];
    })

I want to have two architectures aarch64-apple-darwin and wasm32-unknown-unknown, which works fine, but I would like to also have rustfmt-preview.

But I'm stuck with the stable version

-> % rustfmt --version
rustfmt 1.4.37-stable (59eed8a2 2021-11-01)

Am I doing something wrong?

Configuring this with Clion

I'm a bit of a nix noob. This is my shell config

let
  oxalica_overlay = import (builtins.fetchTarball
    "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
  nixpkgs = import <nixpkgs> { overlays = [ oxalica_overlay ]; };

in with nixpkgs;
pkgs.mkShell {
    # nativeBuildInputs is usually what you want -- plugins you need to run
    nativeBuildInputs = [
        firefox
	jetbrains.clion
        docker
        docker-compose
        openssl.dev
        gcc

        protobuf
	buf
        rustPackages.clippy
        pkg-config
    ];
}

Clion is unable to find the rust toolchain location and stdlib. If I add rustup to buildinputs, it's fine. Does adding rustup conflict with the overlay?

Missing nightly components for `x86_64-unknown-linux-gnu` target

Greetings!

Since 2021-04-25 the profiles default and complete can not be used:

error: Component resolution failed for rust-complete-1.53.0-nightly-2021-04-29
       - note: available extensions are cargo, clippy, clippy-preview, llvm-tools-preview, miri, miri-preview, reproducible-artifacts, rls, rls-preview, rust-analysis, rust-analyzer-preview, rust-docs, rust-mingw, rust-src, rust-std, rustc, rustc-dev, rustc-docs, rustfmt, rustfmt-preview
       - Host component `rustfmt-preview` doesn't support target `x86_64-unknown-linux-gnu`
       - Host component `rls-preview` doesn't support target `x86_64-unknown-linux-gnu`

Miri doesn't work

I used miri from rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override { extensions = [ "rust-src" "miri" ]; })

I get this

$ cargo miri run
I will run `"/nix/store/mwf2a8n4rfpvmphs95qlrap4bjh7kff7-cargo-1.55.0-nightly-2021-07-23/bin/cargo" "install" "xargo"` to install a recent enough xargo. Proceed? [Y/n] y
    Updating crates.io index
     Ignored package `xargo v0.3.23` is already installed, use --force to override
warning: be sure to add `/home/rdp/.cargo/bin` to your PATH to be able to run the installed binaries
thread 'main' panicked at 'failed to determine underlying rustc version of Miri: CommandError { stdout: "", stderr: "/nix/store/iwf95dhfnd630wcp5n4hzx6a8qx9pjjn-miri-preview-1.55.0-nightly-2021-07-23/bin/miri: error while loading shared libraries: librustc_driver-06363a0fe3b2338d.so: cannot open shared object file: No such file or directory\n" }', src/tools/miri/cargo-miri/bin.rs:212:38
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It seems like certain shared libraries are not being linked

$ ldd /nix/store/iwf95dhfnd630wcp5n4hzx6a8qx9pjjn-miri-preview-1.55.0-nightly-2021-07-23/bin/miri
	linux-vdso.so.1 (0x00007ffd02d04000)
	librustc_driver-06363a0fe3b2338d.so => not found
	libstd-1a95cddb5b8aaf6b.so => not found
	libgcc_s.so.1 => /nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib/libgcc_s.so.1 (0x00007fcdd54bd000)
	libpthread.so.0 => /nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib/libpthread.so.0 (0x00007fcdd549d000)
	libm.so.6 => /nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib/libm.so.6 (0x00007fcdd535c000)
	libc.so.6 => /nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib/libc.so.6 (0x00007fcdd5195000)
	/nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib/ld-linux-x86-64.so.2 => /nix/store/j5p0j1w27aqdzncpw73k95byvhh5prw2-glibc-2.33-47/lib64/ld-linux-x86-64.so.2 (0x00007fcdd59a5000)

Cargo error: `failed to resolve address for github.com`

I have these default.nix and build.sh. When I run nix-build I get:

> nix-build
these derivations will be built:
  /nix/store/xba0wbj0ki1fcwwjlskhiiq63r839dna-lobsters-best-bot.drv
building '/nix/store/xba0wbj0ki1fcwwjlskhiiq63r839dna-lobsters-best-bot.drv'...
    Updating crates.io index
warning: spurious network error (2 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
warning: spurious network error (1 tries remaining): failed to resolve address for github.com: Name or service not known; class=Net (12)
error: failed to get `anyhow` as a dependency of package `lobsters-best-bot v0.1.0 (/nix/store/g5d7422cxp3v3xdy0hl44h0l3jwsavj2-lobsters-best-bot)`

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  network failure seems to have happened
  if a proxy or similar is necessary `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to resolve address for github.com: Name or service not known; class=Net (12)
builder for '/nix/store/xba0wbj0ki1fcwwjlskhiiq63r839dna-lobsters-best-bot.drv' failed with exit code 101
error: build of '/nix/store/xba0wbj0ki1fcwwjlskhiiq63r839dna-lobsters-best-bot.drv' failed

However, nix-shell -p cargo --run 'cargo check' runs fine.

I tried using rust-overlay via nix-channel --add ... before, if it's important.

Issue cross-compiling to Windows from NixOS

I'm trying to cross-compile a Rust project to Windows with MinGW. I'm getting the ungoogleable error "rust is no available" and I'm not sure what next steps to take.

This is the smallest shell.nix that can reproduce the problem:

let
  pkgs = import <nixpkgs> {
    crossSystem = { config = "x86_64-w64-mingw32"; };
    overlays = [
      (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
    ];
  };
in pkgs.mkShell { 
  nativeBuildInputs = [
    pkgs.buildPackages.rust-bin.stable.latest.rust
  ];
}

And the error message:

error: while evaluating the attribute 'nativeBuildInputs' of the derivation 'nix-shell-x86_64-w64-mingw32' at /nix/store/0qm06jcncxkn0ds17pawl0kpbj1m0cyi-nixos-21.05.3314.83413f47809/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'paths' of the derivation 'rust-1.55.0' at /nix/store/0qm06jcncxkn0ds17pawl0kpbj1m0cyi-nixos-21.05.3314.83413f47809/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating 'getComponents' at /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:176:81, called from /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:426:26:
while evaluating 'flatten' at /nix/store/0qm06jcncxkn0ds17pawl0kpbj1m0cyi-nixos-21.05.3314.83413f47809/nixos/lib/lists.nix:137:13, called from /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:183:19:
while evaluating 'getTargetPkgTuples' at /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:131:64, called from /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:183:28:
while evaluating 'getExtensions' at /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:109:34, called from /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/rust-overlay.nix:136:20:
while evaluating the attribute 'target.x86_64-w64-windows-gnu' at /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/manifest.nix:67:9:
while evaluating the attribute 'target."*"' at /nix/store/dspngfrg375swrfj5sbcags7chd01bbc-source/manifest.nix:67:9:
rust is no available

silly syntax question when using with a shell.nix

Thank you for making this overlay! I'm quite excited to use it for various Rust projects to make nix integration more reliable and reproducible.

I wanted to use buildPackages.rust-bin.fromRustupToolchainFile ./rust-toolchain but cannot figure out where to put this in a shell.nix.

let
  rust_overlay = import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
  nixpkgs = import <nixpkgs> { overlays = [ rust_overlay ]; };
in
with nixpkgs;
mkShell {
  nativeBuildInputs = [
    # Manual `buildPackages` is required here. See: https://github.com/NixOS/nixpkgs/issues/49526
    buildPackages.rust-bin.stable.latest.rust
    buildPackages.pkg-config
  ];
  buildInputs = [
    openssl
    capnproto
    sqlite
    nettle
    clang
  ];
}

This is my current shell.nix. I tried adding it to nativeBuildInputs but nix-shell failed with a type coercion error.

Fails to find crate dependencies

Hey!

I'm really new to Nix(OS), so this might be an easy/common problem. I've created the following shell.nix file:

(import <nixpkgs> {
  overlays = [ (import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz")) ];
}).callPackage (
{ pkgs, mkShell, rust-bin, pkgsBuildBuild }:
mkShell {
  nativeBuildInputs = [
    (rust-bin.stable.latest.default.override {
      extensions = [ "rust-src" ];
    })

    # Utility CLIs
    pkgs.cargo-edit
    pkgs.cargo-expand
  ];

  RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}) {}

But once I create a nix-shell, I can't compile my project. It doesn't find the dependencies that I specify inside of Cargo.toml. As soon as I remove them, everything works fine and compiles. Any idea what is going on?

How to override stdenv?

I wonder if it's possible to override stdenv when using this overlay?

The problem I'm having has to do with the fact that this overlay uses propagated buildInputs in various places to propagate cc from stdenv. In the project I'm working on I use different cc, but I'm not able to override cc for this overlay no matter what I try, and it override my own cc version in my nix-shell, and everywhere else I depend on rust from this overlay.

Is there any way to override stdenv here?

Help: `nix develop` (nix-shell replacement) example available?

Hello. I'm new-ish to Nix and learning flakes. I am attempting to set up my Rust development environment but I'm struggling to get the rust overlay working with a Flake and this repo.

Do you have a devShell example available?

I'm trying as follows:

{
  description = "Blah";

  inputs = {
    nixpkgs.url      = "github:nixos/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    flake-utils.url  = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
        let 
          pkgs = nixpkgs.legacyPackages.${system}; 
        in
        {
          nixpkgs.overlays = [ rust-overlay.overlay ];
          devShell = pkgs.mkShell {
            buildInputs = [
              pkgs.openssl
              pkgs.exa
              pkgs.ripgrep
              pkgs.watchexec
              pkgs.tokei
              pkgs.bat
              pkgs.fd
              pkgs.terraform
              pkgs.gperftools
              pkgs.wrk
              pkgs.valgrind
              pkgs.rust-bin.nightly.latest.minimal
            ];

            shellHook = ''
              export NIX_ENFORCE_PURITY=0
              alias ls=exa
              alias find=fd
              cargo update 
              cargo install cargo-watch
              cargo install cargo-edit
              cargo install cargo-tarpaulin
              cargo install cargo-audit
              cargo install cargo-outdated
              cargo install cargo-release
              cargo install cargo-udeps
              cargo install xh 
              cargo install zenith 
              export RUST_LOG=debug
              set -o vi
            '';
          };
        }
      );
}

This fails with:


error: --- EvalError ------------------------------------------------------------------------------------------------------------------- nix
at: (30:15) in file: /nix/store/nsq6za0vhagc0h44jwij362j4z8qz1sa-source/flake.nix

    29|               pkgs.valgrind
    30|               pkgs.rust-bin.nightly.latest.minimal
      |               ^
    31|             ];

attribute 'rust-bin' missing

Cross-aarch64 example doesn't work - error: linker `cc` not found

$ make test
nix-shell ./shell.nix --command \
	"cargo test --target aarch64-unknown-linux-gnu --no-run"
  Downloaded openssl-sys v0.9.60
  Downloaded cc v1.0.66
  Downloaded openssl v0.10.32
  Downloaded libc v0.2.85
  Downloaded 4 crates (821.3 KB) in 0.64s
   Compiling cc v1.0.66
   Compiling pkg-config v0.3.19
   Compiling autocfg v1.0.1
   Compiling libc v0.2.85
   Compiling bitflags v1.2.1
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.32
   Compiling cfg-if v1.0.0
   Compiling lazy_static v1.4.0
   Compiling foreign-types v0.3.2
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: could not compile `openssl`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: linker `cc` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: build failed
make: *** [Makefile:8: all] Errore 101

NixOS version: 21.05

It doesn't work with my project either (which has the same files adapted to armv7):

shell.nix:

with import <nixpkgs>
{
  crossSystem = "armv7l-linux";
  overlays = [
    (import
      (builtins.fetchTarball
        "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
  ];
};
mkShell {
  nativeBuildInputs = [
    buildPackages.rust-bin.stable.latest.minimal
    buildPackages.pkg-config
    pkgsBuildBuild.qemu
  ];
  buildInputs = [
    gcc
    openssl
  ];
}

.cargo/config:

[build]
target-dir = "target"

[target.armv7-unknown-linux-gnueabihf]
linker = "armv7l-unknown-linux-gnueabihf-gcc"
runner = "qemu-arm"

Question: operability with +nightly commands

Hey ๐Ÿ‘‹

I currently ran into an issue where a repo that I work on started using the following command:

cargo +nightly fmt -- --check

but because the +nightly isn't being recognised. I noticed your comment here #49 (comment), so I'm guessing this might not be possible to interop with? Is there any way I can work around this?

My shell.nix looks like:

let
  nixpkgs = import <nixpkgs> {};
  stable = nixpkgs.rust-bin.stable.latest.default;
  rust = stable.override {
    extensions = [ "rust-src" "rust-analysis" ];
  };
in
  with nixpkgs;
  mkShell {
    name = "rust";
    buildInputs = [
        cargo-deny
        cargo-expand
        cargo-watch
        cmake
        openssl
        pkgconfig
        ripgrep
        rust
    ];
  }

Thanks for any help you can provide ๐Ÿ˜Š

Configuring with clion

I'm a big nix noob, trying to configure nix-shell with Clion

let
  oxalica_overlay = import (builtins.fetchTarball
    "https://github.com/oxalica/rust-overlay/archive/master.tar.gz");
  nixpkgs = import <nixpkgs> { overlays = [ oxalica_overlay ]; };

in with nixpkgs;
pkgs.mkShell {
    # nativeBuildInputs is usually what you want -- plugins you need to run
    nativeBuildInputs = [
        firefox
	jetbrains.clion
        docker
        docker-compose
        openssl.dev
        gcc

        rust-bin.stable.latest.rust
        rustup
        protobuf
	buf
        rustPackages.clippy
        pkg-config
    ];
}

Clion is unable to find the rust toolchain and stdlib with this config. Adding rustup makes it all work. Does adding rustup conflict with the overlay?

toolchain.toml "profile" setting is not supported

I was trying to set a toolchain.toml with a set profile (see toolchain doc) as follows:

[toolchain]
channel = "nightly"
profile = "minimal"

When running with:

        let
          rust_channel =
            pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
        in pkgs.mkShell {
          nativeBuildInputs = with pkgs; [
            (rust_channel.override {
              extensions = [
                "rust-doc"
                "rusftfmt"
                "clippy"
                "rust-src"
                "rust-analysis"
                "rust-analyzer-preview"
              ];
            })
            pkgconfig
          ];
          buildInputs = with pkgs; [ openssl ];
        };

this results in:

direnv: loading ~/Documents/Projects/tlaternet/.envrc
direnv: using flake
warning: Git tree '/home/tlater/Documents/Projects/tlaternet' is dirty
error: 'fromRustupToolchain' at /nix/store/aw2snbray3282aada3wfq156kij2qg2w-source/rust-overlay.nix:50:25 called with unexpected argument 'profile'

       at /nix/store/aw2snbray3282aada3wfq156kij2qg2w-source/rust-overlay.nix:63:10:

           62|     then fromRustupToolchain { channel = head legacy; }
           63|     else fromRustupToolchain (fromTOML content).toolchain;
             |          ^
           64|
(use '--show-trace' to show detailed location information)
direnv: renewed cache

This is a bit unfortunate! it would be nice to be able to build a flake that can build my package with the absolute minimal profile, but gives me a dev shell with all the nice-to-haves from the default profile.

Issues with 'version `GLIBC_2.32' not found' when running clippy on CI

# flake.nix

{
  description = "chainlink-terra";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay.url = "github:oxalica/rust-overlay";
  };

  outputs = inputs@{ self, nixpkgs, rust-overlay, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlay ]; };
      in rec {
        devShell = pkgs.callPackage ./shell.nix {};
      });
}
# shell.nix

{ stdenv, pkgs, lib }:

pkgs.mkShell {
  nativeBuildInputs = with pkgs; [
    (rust-bin.stable.latest.default.override {
      extensions = ["rust-src"];
      targets = [
        "x86_64-unknown-linux-gnu"
        "wasm32-unknown-unknown"
      ];
    })
    cargo-generate
    cargo-tarpaulin
  ];
  RUST_BACKTRACE = "1";
}

When running nix develop -c cargo clippy --all-targets -- -D warnings it fails during proc macro checking:

    Checking thiserror v1.0.29
error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /home/runner/work/foo/target/debug/deps/libthiserror_impl-22080d5093a0fbd6.so)
   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/thiserror-1.0.29/src/lib.rs:213:9
    |
213 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^

However compiling, running tests, nix develop -c cargo fmt or nix develop -c cargo build --release --target wasm32-unknown-unknown all works fine.

Possibly related: https://internals.rust-lang.org/t/bootstrap-fails-with-linker-error-while-running-on-non-nixos-nix-environment-wsl2-ubuntu/15066/2

Brainstorming: A way to build a rustup-compatible toolchain set?

I'm developing in rust in various repos (many of which won't include any nix shell definitions) , and really like the way you can run, e.g., cargo +nightly test to run tests with a specific toolchain. Now I just realized that since rust-overlay already provides the toolchains in a very rustup-alike way, and that the two might be compatible; are you aware of a way to build a symlink tree to the rust toolchains provided by rust-overlay that allows the rustup stub binaries to use them? Otherwise, I might explore building something like it.

Question: Installing cargo plugins?

Is there a preferred way to install plugins for cargo? It seems to me like it should be part of the overlay as the version of cargo is coming from the overlay, but maybe there is another way.

I've seen some examples of people doing it with shellHooks but I seem to run into networking issues as I sort of would have expected. I can do it after I've entered into a nix-shell, but would really prefer if it was declarative and automated. Or if there is already a way, I haven't been able to find documentation for it.

Cannot use `complete` profile on latest stable

Trying to use the complete profile on rust 1.52.1 gives me this error:

error: Component resolution failed for rust-complete-1.52.1
- note: available extensions are cargo, clippy, clippy-preview, llvm-tools-preview, miri, miri-preview, reproducible-artifacts, rls, rls-preview, rust-analysis, rust-analyzer-preview, rust-docs, rust-mingw, rust-src, rust-std, rustc, rustc-dev, rustc-docs, rustfmt, rustfmt-preview
- Host component `rust-analyzer-preview` doesn't support target `x86_64-apple-darwin`
- Host component `miri-preview` doesn't support target `x86_64-apple-darwin`

`clippy` from 1.59.0-beta.8-2022-02-13 is broken on x86_64-darwin

install_name_tool failed to add correct RPATH to clippy-driver due to insufficient Mach-O header space.

I have no darwin devices and are not familiar with darwin platform. If anyone has ideas to fix this, PR is welcome.

CI log.

building '/nix/store/yxfzm26344rhqmf7q546v0wi36p3qikr-clippy-preview-1.59.0-beta.8-2022-02-13-x86_64-apple-darwin.drv'...
unpacking sources
unpacking source archive /nix/store/qk2gfnhypdxp431m130pylx6142a85gk-clippy-beta-x86_64-apple-darwin.tar.xz
source root is clippy-beta-x86_64-apple-darwin
setting SOURCE_DATE_EPOCH to timestamp 1644701173 of file clippy-beta-x86_64-apple-darwin/version
patching sources
installing
Installing component clippy-preview
post-installation fixup
patching script interpreter paths in /nix/store/m2h1g2zspsgmb80rmbsf138qfv0zgg2i-clippy-preview-1.59.0-beta.8-2022-02-13-x86_64-apple-darwin
error: install_name_tool: changing install names or rpaths can't be redone for: /nix/store/m2h1g2zspsgmb80rmbsf138qfv0zgg2i-clippy-preview-1.59.0-beta.8-2022-02-13-x86_64-apple-darwin/bin/clippy-driver (for architecture x86_64) because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names)

The llvm-tools-preview component does not work

The executables of the llvm-tools-preview component will not work, because they are unable to unable to find libLLVM-12-rust-1.53.0-nightly.so.

Example output from launching llvm-size:

/nix/store/1q3p2a6vn7xcc3bl7pms0l1wv09dyl1q-rust-default-1.53.0-nightly-2021-04-19/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size
/nix/store/1q3p2a6vn7xcc3bl7pms0l1wv09dyl1q-rust-default-1.53.0-nightly-2021-04-19/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-size: error while loading shared libraries: libLLVM-12-rust-1.53.0-nightly.so: cannot open shared object file: No such file or directory

Workaround:

export LD_LIBRARY_PATH=${rust-derivation}/lib

How to use the overlay for Rust Language Server?

I use VSCode, and it fails to start the Rust Language Server for my project using this overlay. From IDE logs,

Error: Command failed: rustup toolchain list
/bin/sh: rustup: command not found

What's the idiomatic way to configure this overlay in my flake.nix[1] so that when VSCode is launched in nix develop to the point that the Rust IDE extension works?

Thanks!

[1] You can find mine here: https://github.com/srid/bouncy/blob/afec3ca7c8771c035adfcbf32031f31f1bf568a4/flake.nix

crossSystem results in failed componentResolution

I'm developing a cross compiling example and fixing up build & host offsets for the various build cases such as test.

You can see my cargo2nix branch here:
cargo2nix/cargo2nix#214

/examples/3-cross-compiling is the flake of interest. The overlay in /overlays is used to consume the /examples/3-cross-compiling/Cargo.nix in that example's flake file.

I can configure oxalica to give me a Rust toolchain capable of outputting wasm32-wasi, failing only when the stdenv lacks any final wasi linking capability.

To get such a stdenv, I should configure a crossPlatform. However, when I do so, this overlay errors out with a failure to resolve components:

error: Component resolution failed for rust-minimal-1.56.1
       - Target `wasm32-unknown-wasi` is not supported by any components or extensions
       - note: all extensions are: cargo clippy clippy-preview llvm-tools-preview miri miri-preview reproducible-artifacts rls rls-preview rust-analysis rust-analyzer-preview rust-docs rust-mingw rust-src rust-std rustc rustc-dev rustc-docs rustfmt rustfmt-preview
       - note: extensions available for x86_64-unknown-linux-gnu are: cargo clippy clippy-preview llvm-tools-preview reproducible-artifacts rls rls-preview rust-analysis rust-docs rust-std rustc rustc-dev rustc-docs rustfmt rustfmt-preview
       - note: extensions available for wasm32-unknown-wasi are: <empty>
       - note: extensions available for wasm32-wasi are: rust-analysis rust-std
       - note: Check here to see whether a component is available for rustup:
                 https://rust-lang.github.io/rustup-components-history



       โ€ฆ while evaluating 'resolveComponents'

I suspect that instead of host & target, the overlay should be using build & host. This hunk here using target caught my attention:

getComponentsWithFixedPlatform = pkgs: pkgname: stdenv:
let
pkg = pkgs.${pkgname};
srcInfo = pkg.target.${super.rust.toRustTarget stdenv.targetPlatform} or pkg.target."*";
components = srcInfo.components or [];
componentNamesList =
builtins.map (pkg: pkg.pkg) (builtins.filter (pkg: (pkg.target != "*")) components);
in
componentNamesList;
getExtensions = pkgs: pkgname: stdenv:
let
inherit (super.lib) unique;
pkg = pkgs.${pkgname};
rustTarget = super.rust.toRustTarget stdenv.targetPlatform;
srcInfo = pkg.target.${rustTarget} or pkg.target."*" or (throw "${pkgname} is no available");
extensions = srcInfo.extensions or [];
extensionNamesList = unique (builtins.map (pkg: pkg.pkg) extensions);
in
extensionNamesList;

My current belief is that target is never used in nixpkgs except when crossing to make a compiler for a third platform, a rare case that can be abstracted out as implementation details for bootstrapping onto a new platform. Rust seems to use host-target terminology. Nix views these offsets as build-host. Backing up by one offset to build-host seems correct. Translation to Rust target triples would be unaffected.

If I'm wrong about this, it will undermine my entire understanding of cross compilation, so I am eager to get to the truth ๐Ÿฑ

At present, everything is working fine for explicit or crossSystem configured targets like aarch64-unknonwn-linux-gnu which have lots of Rust components available. Only when targeting wasi, which only has a rust-std available for that target, do I get these component resolution errors.

Cross-compilation with MinGW broken

Hi,

c7ed82b broke our cross-compilation for Windows. It seems that with this change, buildInputs (i.e. depsHostTarget) end up in the linker for the build platform (i.e. Linux) which results in /nix/store/5ddb4j8z84p6sjphr0kh6cbq5jd12ncs-binutils-2.35.1/bin/ld: /nix/store/pl9raxwyb6jg662ljd9f1q3hrb2cni8l-pthreads-w32-x86_64-w64-mingw32-2.9.1/lib/libpthread.a: error adding symbols: file format not recognized.

The commit before c7ed82b works as expected.

NIX_LDFLAGS and NIX_LDFLAGS_FOR_BUILD looks the same in both a working and non-working case though?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.