Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,18 @@ let
cargo_message_format="json"
fi

# Rust's `libtest` defaults to running tests in parallel and uses as many
# threads as there are cores. This is often too much parallelism so we
# reduce it to $NIX_BUILD_CORES if not specified by the caller.
export RUST_TEST_THREADS="''${RUST_TEST_THREADS:-$NIX_BUILD_CORES}"

log "cargo_version (read): $cargo_version"
log "cargo_message_format (set): $cargo_message_format"
log "cargo_release: $cargo_release"
log "cargo_options: $cargo_options"
log "cargo_build_options: $cargo_build_options"
log "cargo_test_options: $cargo_test_options"
log "RUST_TEST_THREADS: $RUST_TEST_THREADS"
log "cargo_bins_jq_filter: $cargo_bins_jq_filter"
log "cargo_build_output_json (created): $cargo_build_output_json"
log "crate_sources: $crate_sources"
Expand Down
9 changes: 9 additions & 0 deletions lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ rec
checkout = builtins.fetchGit {
url = v.git;
rev = v.rev;
# This is to work around a bug in `builtins.fetchGit` where
# specifying a `rev` which is not an ancestor of HEAD
# results in a git error. When setting `ref` to `rev` we
# force Nix to fetch the `rev`.
#
# TODO: This hack can be removed once the following is
# merged and released:
# https://github.com/NixOS/nix/pull/3408
ref = v.rev;
};
}
) cargotoml.dependencies or {});
Expand Down