Unverified Commit d6d092f8 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

{buildRustPackage,fetchCargoTarball,fetchCargoVendor}: respect cargoRoot (#350541)

parents 2bedc788 ffcd0486
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
, cargoPatches ? []
, patches ? []
, sourceRoot ? null
, cargoRoot ? null
, logLevel ? ""
, buildInputs ? []
, nativeBuildInputs ? []
@@ -72,13 +73,13 @@ let
    else if cargoDeps != null then cargoDeps
    else if cargoLock != null then importCargoLock cargoLock
    else if useFetchCargoVendor then fetchCargoVendor ({
      inherit src srcs sourceRoot preUnpack unpackPhase postUnpack;
      inherit src srcs sourceRoot cargoRoot preUnpack unpackPhase postUnpack;
      name = cargoDepsName;
      patches = cargoPatches;
      hash = args.cargoHash;
    } // depsExtraArgs)
    else fetchCargoTarball ({
      inherit src srcs sourceRoot preUnpack unpackPhase postUnpack cargoUpdateHook;
      inherit src srcs sourceRoot cargoRoot preUnpack unpackPhase postUnpack cargoUpdateHook;
      name = cargoDepsName;
      patches = cargoPatches;
    } // lib.optionalAttrs (args ? cargoHash) {
+4 −0
Original line number Diff line number Diff line
@@ -85,6 +85,10 @@ stdenv.mkDerivation (
      # Ensure deterministic Cargo vendor builds
      export SOURCE_DATE_EPOCH=1

      if [ -n "''${cargoRoot-}" ]; then
        cd "$cargoRoot"
      fi

      if [[ ! -f Cargo.lock ]]; then
          echo
          echo "ERROR: The Cargo.lock file doesn't exist"
+4 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ let
      buildPhase = ''
        runHook preBuild

        if [ -n "''${cargoRoot-}" ]; then
          cd "$cargoRoot"
        fi

        fetch-cargo-vendor-util create-vendor-staging ./Cargo.lock "$out"

        runHook postBuild
+0 −7020

File deleted.

Preview size limit exceeded, changes collapsed.

+3 −8
Original line number Diff line number Diff line
@@ -34,16 +34,11 @@ rustPlatform.buildRustPackage rec {
    hash = "sha256-hvWXSegUWJvwCU5NLb2vqnl+FIWpCLxw96s9NUIgJTI=";
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "tauri-plugin-log-0.0.0" = "sha256-t+zmMMSnD9ASZZvqlhu1ah2OjCUtRXdk/xaI37uI49c=";
      "vampirc-uci-0.11.1" = "sha256-g2JjHZoAmmZ7xsw4YnkUPRXJxsYmBqflWxCFkFEvMXQ=";
    };
  };

  cargoRoot = "src-tauri";

  useFetchCargoVendor = true;
  cargoHash = "sha256-6cBGOdJ7jz+mOl2EEXxoLNeX9meW+ybQxAxnnHAplIc=";

  buildAndTestSubdir = cargoRoot;

  nativeBuildInputs =
Loading