about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2017-04-23 11:26:47 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2017-04-23 11:26:47 +0200
commit4fc9b1852a7707d5531355b588c3d2edc769b0cb (patch)
treeca2336852c3f067960f8631ab2bcc1917ae4beca /pkgs/build-support
parent004ecac47b4639c6f8a8419ce2e1dcd18c78268b (diff)
parentf45f2fb67a4f620938e8b05941e8d8297661fd35 (diff)
downloadnixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar.gz
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar.bz2
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar.lz
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar.xz
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.tar.zst
nixlib-4fc9b1852a7707d5531355b588c3d2edc769b0cb.zip
Merge remote-tracking branch 'upstream/master' into HEAD
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchurl/default.nix2
-rwxr-xr-xpkgs/build-support/rust/fetch-cargo-deps32
2 files changed, 33 insertions, 1 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index 1e872fbc57a4..fea06e22ab46 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -92,7 +92,7 @@ let
 
 in
 
-if md5 != "" then throw "fetchsvnssh does not support md5 anymore, please use sha256 or sha512"
+if md5 != "" then throw "fetchurl does not support md5 anymore, please use sha256 or sha512"
 else if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${stdenv.lib.concatStringsSep ", " urls_}"
 else stdenv.mkDerivation {
   name =
diff --git a/pkgs/build-support/rust/fetch-cargo-deps b/pkgs/build-support/rust/fetch-cargo-deps
index 54593994990f..76661a4f9ecc 100755
--- a/pkgs/build-support/rust/fetch-cargo-deps
+++ b/pkgs/build-support/rust/fetch-cargo-deps
@@ -1,3 +1,18 @@
+# copied from libgit2 source code 'repo-template.h'
+makeGitTemplate() {
+    local target="$1"
+    mkdir -p -m777 "$target/info" "$target/pack" "$target/objects" "$target/refs"
+    mkdir -p -m777 "$target/refs/heads" "$target/refs/tags" "$target/objects/info" "$target/objects/pack"
+    cat <<'EOF' > "$target/description"
+Unnamed repository; edit this file 'description' to name the repository.
+EOF
+    chmod 666 "$target/description"
+    cat <<'EOF' > "$target/info/exclude"
+# File patterns to ignore; see `git help ignore` for more information.
+# Lines that start with '#' are comments.
+EOF
+}
+
 fetchCargoDeps() {
     src=$(realpath $1)
     out=$(realpath $2)
@@ -6,6 +21,23 @@ fetchCargoDeps() {
 
     mkdir $out
 
+    # Configure git template dir to make libgit2 more deterministic
+    #
+    # Without a template dir, libgit2 defaults to /usr/share/git-core/templates,
+    # which can vary between systems if sandboxed builds aren't used.
+    #
+    # Note: we explictly set --tmpdir for mktemp here to make it more friendly
+    # for nix-shell users, where $TMPDIR is not necessarily set to NIX_BUILD_TOP
+    echo "Setting up git templatedir"
+    export GIT_TEMPLATE_DIR="$(mktemp -d --tmpdir=$NIX_BUILD_TOP git-template.XXX)"
+    makeGitTemplate "$GIT_TEMPLATE_DIR"
+    export XDG_CONFIG_HOME="$(mktemp -d --tmpdir=$NIX_BUILD_TOP home.XXX)"
+    mkdir -p $XDG_CONFIG_HOME/git
+    cat <<EOF > $XDG_CONFIG_HOME/git/config
+[init]
+  templatedir = $GIT_TEMPLATE_DIR
+EOF
+
     # Configure cargo to fetch from a local copy of the crates.io registry
 
     echo "Using rust registry from $rustRegistry"