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

Building rustChannelOf({...}).rust-src from rust-overlay.nix errors. #304

Closed
calbrecht opened this issue Feb 4, 2023 · 6 comments · May be fixed by #309
Closed

Building rustChannelOf({...}).rust-src from rust-overlay.nix errors. #304

calbrecht opened this issue Feb 4, 2023 · 6 comments · May be fixed by #309

Comments

@calbrecht
Copy link
Contributor

Don't know if i am supposed to be able to do that, however until f6fe850 was merged, i was able to do so by using the overlay like:

...
        rustStable = (prev.rustStable or { }) // (prev.rustChannelOf or pkgs.rustChannelOf) {
          sha256 = "sha256-oro0HsosbLRAuZx68xd0zfgPl6efNj2AQruKRq3KA2g="; #2022-05-24
          channel = "stable";
        };
        
        rust-stable = final.rustStable.rust // final.rust-analyzer;
        rust-src-stable = final.rustStable.rust-src;

Although, now after the mentioned commit, the build of rust-src-stable errors and exits and therefore fails the build, when chmod and after fixing that, also realpath -e are complaining about missing arguments.

@calbrecht
Copy link
Contributor Author

calbrecht commented Feb 4, 2023

I fi rewrite the commit to 642c846 i am able to build as before.

@calbrecht
Copy link
Contributor Author

calbrecht commented Feb 4, 2023

I have to admit that this overlay is over my head, as well as the circumstance that the ls check is failing to protect against the non-existance of the librustc-driver-*.so library.

dbeckwith added a commit to dbeckwith/nixpkgs-mozilla that referenced this issue Mar 5, 2023
fatho pushed a commit to fatho/nixpkgs-mozilla that referenced this issue Mar 11, 2023
@alexhicks
Copy link

I seem to be getting this as well trying to install on aarch64-darwin and using nix develop. Works fine on x86_64-linux.
Previously this was working.

error: builder for '/nix/store/lmx39jmjn1xh9dnvab13b39rhv2pd1qp-rust-1.68.0-2023-03-06-2c8cc3432.drv' failed with exit code 1;
       last 10 log lines:
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > /private/tmp/nix-build-rust-1.68.0-2023-03-06-2c8cc3432.drv-0/.attr-0l2nkwhif96f51f4amnlf414lhl4rv9vh8iffyp431v6s28gsr90: line 18: patchelf: command not found
       > realpath: missing operand
       > Try 'realpath --help' for more information.
       For full logs, run 'nix log /nix/store/lmx39jmjn1xh9dnvab13b39rhv2pd1qp-rust-1.68.0-2023-03-06-2c8cc3432.drv'.
error: 1 dependencies of derivation '/nix/store/md5aq8fhajxjvdqw4fklb37bnlyyparl-nix-shell-env.drv' failed to build

Shell setup:

// flake.nix (truncated)
{
  description = "My NixOS Hosts";
  inputs = {
    # Nixpkgs
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    hardware.url = "github:nixos/nixos-hardware";
    # Rust
    mozpkgs = {
      url = "github:mozilla/nixpkgs-mozilla";
    };
  };

  outputs = { self, nixpkgs, mozpkgs, ... }@inputs:
    let
      inherit (self) outputs;
      forAllSystems = nixpkgs.lib.genAttrs [
        #"aarch64-linux"
        #"i686-linux"
        "x86_64-linux"
        "aarch64-darwin"
        #"x86_64-darwin"
      ];
    in
    rec {
      overlays = import ./overlays;
      legacyPackages = forAllSystems (system:
        import nixpkgs {
          inherit system;
          overlays = with overlays; [ additions mozpkgs.overlays.rust ];
          config.allowUnfree = true;
        }
      );
      # Devshell for bootstrapping
      # Acessible through 'nix develop' or 'nix-shell' (legacy)
      devShells = forAllSystems (system:
        let pkgs = legacyPackages.${system};
        in import ./shell.nix { inherit pkgs; }
      );
    };
};

// shell.nix
{ pkgs ? (import ./nixpkgs.nix) { } }: {
  default = pkgs.mkShell {
    # Enable experimental features without having to specify the argument
    NIX_CONFIG = "experimental-features = nix-command flakes";
    nativeBuildInputs = with pkgs; [ nix git ];
  };
  rust = pkgs.mkShell {
    nativeBuildInputs = with pkgs; [
      rust-analyzer # the one from Mozilla is slightly broken https://github.com/mozilla/nixpkgs-mozilla/issues/238
      latest.rustChannels.stable.rust
      pkg-config
      openssl
    ];
  };
}

shell is invoked with: nix develop --impure ~/nix-config#rust --command zsh

ggreif referenced this issue Apr 25, 2023
Rust changed the way the SYSROOT is determined in: rust-lang/rust#103660

Before this change the SYSROOT was determined based on the rustc
executable. Now it is determined based on the librustc_driver-*.so file.
This pr fixes the detection by copying the library to the derivation as
we have done it for the rustc executable.
@AliSajid
Copy link

AliSajid commented May 8, 2023

I'm running into this issue as well. I'm new to nix so any help or guidance would be appreciated.

@nickgerace
Copy link

I am hitting this too.

@calbrecht
Copy link
Contributor Author

Fixed in #317

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

Successfully merging a pull request may close this issue.

4 participants