lol

build-support: Simplify tmpdir creation with coreutils

macOS 10.12 doesn't have a usable --tmpdir flag on the builtin mktemp, but we can
make use of coreutil's mktemp instead.

+10 -12
+1 -1
pkgs/build-support/docker/nix-prefetch-docker
··· 123 123 124 124 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 125 125 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 126 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/skopeo-copy-tmp-XXXXXXXX")")" 126 + tmpPath="$(realpath "$(mktemp -d --tmpdir skopeo-copy-tmp-XXXXXXXX)")" 127 127 trap "rm -rf \"$tmpPath\"" EXIT 128 128 129 129 tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)"
+2 -2
pkgs/build-support/docker/nix-prefetch-docker.nix
··· 1 - { lib, stdenv, makeWrapper, nix, skopeo, jq }: 1 + { lib, stdenv, makeWrapper, nix, skopeo, jq, coreutils }: 2 2 3 3 stdenv.mkDerivation { 4 4 name = "nix-prefetch-docker"; ··· 10 10 installPhase = '' 11 11 install -vD ${./nix-prefetch-docker} $out/bin/$name; 12 12 wrapProgram $out/bin/$name \ 13 - --prefix PATH : ${lib.makeBinPath [ nix skopeo jq ]} \ 13 + --prefix PATH : ${lib.makeBinPath [ nix skopeo jq coreutils ]} \ 14 14 --set HOME /homeless-shelter 15 15 ''; 16 16
+1 -1
pkgs/build-support/fetchbzr/nix-prefetch-bzr
··· 44 44 if test -z "$finalPath"; then 45 45 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 46 46 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 47 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/bzr-checkout-tmp-XXXXXXXX")")" 47 + tmpPath="$(realpath "$(mktemp -d --tmpdir bzr-checkout-tmp-XXXXXXXX)")" 48 48 trap "rm -rf \"$tmpPath\"" EXIT 49 49 50 50 tmpFile="$tmpPath/$dstFile"
+1 -1
pkgs/build-support/fetchcvs/nix-prefetch-cvs
··· 22 22 mkTempDir() { 23 23 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 24 24 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 25 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/nix-prefetch-cvs-XXXXXXXX")")" 25 + tmpPath="$(realpath "$(mktemp -d --tmpdir nix-prefetch-csv-XXXXXXXX)")" 26 26 trap removeTempDir EXIT 27 27 } 28 28
+1 -2
pkgs/build-support/fetchgit/nix-prefetch-git
··· 453 453 # If we don't know the hash or a path with that hash doesn't exist, 454 454 # download the file and add it to the store. 455 455 if test -z "$finalPath"; then 456 - 457 456 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 458 457 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 459 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/git-checkout-tmp-XXXXXXXX")")" 458 + tmpPath="$(realpath "$(mktemp -d --tmpdir git-checkout-tmp-XXXXXXXX)")" 460 459 exit_handlers+=(remove_tmpPath) 461 460 462 461 tmpFile="$tmpPath/$(url_to_name "$url" "$rev")"
+1 -2
pkgs/build-support/fetchhg/nix-prefetch-hg
··· 42 42 # If we don't know the hash or a path with that hash doesn't exist, 43 43 # download the file and add it to the store. 44 44 if [[ -z "$finalPath" ]]; then 45 - 46 45 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 47 46 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 48 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/hg-checkout-tmp-XXXXXXXX")")" 47 + tmpPath="$(realpath "$(mktemp -d --tmpdir hg-checkout-tmp-XXXXXXXX)")" 49 48 cleanup() { x=$?; rm -rf "$tmpPath"; exit $x; }; trap cleanup EXIT 50 49 51 50 tmpArchive="$tmpPath/hg-archive"
+1 -1
pkgs/build-support/fetchsvn/nix-prefetch-svn
··· 43 43 if test -z "$finalPath"; then 44 44 # nix>=2.20 rejects adding symlinked paths to the store, so use realpath 45 45 # to resolve to a physical path. https://github.com/NixOS/nix/issues/11941 46 - tmpPath="$(realpath "$(mktemp -d "${TMPDIR:-/tmp}/svn-checkout-tmp-XXXXXXXX")")" 46 + tmpPath="$(realpath "$(mktemp -d --tmpdir svn-checkout-tmp-XXXXXXXX)")" 47 47 trap "rm -rf \"$tmpPath\"" EXIT 48 48 49 49 tmpFile="$tmpPath/$dstFile"
+2 -2
pkgs/tools/package-management/nix-prefetch-scripts/default.nix
··· 13 13 installPhase = '' 14 14 install -vD ${src} $out/bin/$name; 15 15 wrapProgram $out/bin/$name \ 16 - --prefix PATH : ${lib.makeBinPath (deps ++ [ gnused nix ])} \ 16 + --prefix PATH : ${lib.makeBinPath (deps ++ [ coreutils gnused nix ])} \ 17 17 --set HOME /homeless-shelter 18 18 ''; 19 19 ··· 28 28 in rec { 29 29 nix-prefetch-bzr = mkPrefetchScript "bzr" ../../../build-support/fetchbzr/nix-prefetch-bzr [ breezy ]; 30 30 nix-prefetch-cvs = mkPrefetchScript "cvs" ../../../build-support/fetchcvs/nix-prefetch-cvs [ cvs ]; 31 - nix-prefetch-git = mkPrefetchScript "git" ../../../build-support/fetchgit/nix-prefetch-git [ coreutils findutils gawk git git-lfs ]; 31 + nix-prefetch-git = mkPrefetchScript "git" ../../../build-support/fetchgit/nix-prefetch-git [ findutils gawk git git-lfs ]; 32 32 nix-prefetch-hg = mkPrefetchScript "hg" ../../../build-support/fetchhg/nix-prefetch-hg [ mercurial ]; 33 33 nix-prefetch-svn = mkPrefetchScript "svn" ../../../build-support/fetchsvn/nix-prefetch-svn [ subversion ]; 34 34