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