Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 690dd986b234
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 23593e42c8d2
Choose a head ref
  • 3 commits
  • 2 files changed
  • 1 contributor

Commits on Jan 28, 2020

  1. Copy the full SHA
    19698d1 View commit details
  2. buildRustCrate: fix #78412

    `build.rs` files might create files. Those files are supposed to go into
    `OUT_DIR` (envirionment variable) and not be overlayed onto the source
    tree.
    andir committed Jan 28, 2020
    Copy the full SHA
    a57d0fe View commit details

Commits on Jan 30, 2020

  1. Merge pull request #78706 from andir/buildRustCrate-no-out-path-overl…

    …aying
    
    buildRustCrate: do not overlay OUT_PATH on src/
    andir authored Jan 30, 2020
    Copy the full SHA
    23593e4 View commit details
Showing with 21 additions and 9 deletions.
  1. +0 −9 pkgs/build-support/rust/build-rust-crate/configure-crate.nix
  2. +21 −0 pkgs/build-support/rust/build-rust-crate/test/default.nix
9 changes: 0 additions & 9 deletions pkgs/build-support/rust/build-rust-crate/configure-crate.nix
Original file line number Diff line number Diff line change
@@ -137,16 +137,7 @@ in ''
CRATENAME=$(echo ${crateName} | sed -e "s/\(.*\)-sys$/\U\1/")
grep -P "^cargo:(?!(rustc-|warning=|rerun-if-changed=|rerun-if-env-changed))" target/build/${crateName}.opt \
| sed -e "s/cargo:\([^=]*\)=\(.*\)/export DEP_$(echo $CRATENAME)_\U\1\E=\2/" > target/env
set -e
if [[ -n "$(ls target/build/${crateName}.out)" ]]; then
if [[ -e "${libPath}" ]]; then
cp -r target/build/${crateName}.out/* $(dirname ${libPath}) #*/
else
cp -r target/build/${crateName}.out/* src #*/
fi
fi
fi
runHook postConfigure
''
21 changes: 21 additions & 0 deletions pkgs/build-support/rust/build-rust-crate/test/default.nix
Original file line number Diff line number Diff line change
@@ -199,6 +199,27 @@ let
})
];
};
# Regression test for https://github.com/NixOS/nixpkgs/issues/74071
# Whenevever a build.rs file is generating files those should not be overlayed onto the actual source dir
buildRsOutDirOverlay = {
src = symlinkJoin {
name = "buildrs-out-dir-overlay";
paths = [
(mkLib "src/lib.rs")
(mkFile "build.rs" ''
use std::env;
use std::ffi::OsString;
use std::fs;
use std::path::Path;
fn main() {
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR not set");
let out_file = Path::new(&out_dir).join("lib.rs");
fs::write(out_file, "invalid rust code!").expect("failed to write lib.rs");
}
'')
];
};
};
};
brotliCrates = (callPackage ./brotli-crates.nix {});
in lib.mapAttrs (key: value: mkTest (value // lib.optionalAttrs (!value?crateName) { crateName = key; })) cases // {