mozilla / nixpkgs-mozilla

Mozilla overlay for Nixpkgs.
MIT License
516 stars 128 forks source link

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

Closed calbrecht closed 1 year ago

calbrecht commented 1 year ago

Don't know if i am supposed to be able to do that, however until https://github.com/mozilla/nixpkgs-mozilla/commit/f6fe8508b0910b84b74c0e0bfa0ff8593e77d470 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 commented 1 year ago

I fi rewrite the commit to https://github.com/mozilla/nixpkgs-mozilla/commit/642c846fa3ed20ee04d717e8bbd6176f038588c0 i am able to build as before.

calbrecht commented 1 year ago

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.

alexhicks commented 1 year ago

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

AliSajid commented 1 year ago

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

nickgerace commented 1 year ago

I am hitting this too.

calbrecht commented 1 year ago

Fixed in https://github.com/mozilla/nixpkgs-mozilla/pull/317