2015-11-21 13:56:56 +01:00
|
|
|
{ stdenv, makeWrapper, buildEnv,
|
2016-02-29 04:47:44 +01:00
|
|
|
git, subversion, mercurial, bazaar, cvs, unzip, curl, gnused, coreutils, nix
|
2015-11-16 11:53:29 +01:00
|
|
|
}:
|
2014-06-10 17:36:41 +02:00
|
|
|
|
2015-11-21 13:56:56 +01:00
|
|
|
let mkPrefetchScript = tool: src: deps:
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "nix-prefetch-${tool}";
|
|
|
|
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
phases = [ "installPhase" "fixupPhase" ];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
2014-06-10 17:36:41 +02:00
|
|
|
|
2014-06-22 11:42:34 +02:00
|
|
|
local wrapArgs=""
|
2015-11-21 13:56:56 +01:00
|
|
|
cp ${src} $out/bin/$name;
|
|
|
|
for dep in ${stdenv.lib.concatStringsSep " " deps}; do
|
2014-06-22 11:42:34 +02:00
|
|
|
wrapArgs="$wrapArgs --prefix PATH : $dep/bin"
|
2014-06-21 05:05:48 +02:00
|
|
|
done
|
2014-06-22 11:42:34 +02:00
|
|
|
wrapArgs="$wrapArgs --prefix PATH : ${gnused}/bin"
|
2016-05-14 20:10:23 +02:00
|
|
|
wrapArgs="$wrapArgs --prefix PATH : ${nix.out}/bin" # For nix-hash
|
2015-01-15 03:24:06 +01:00
|
|
|
wrapArgs="$wrapArgs --set HOME : /homeless-shelter"
|
2014-06-21 05:05:48 +02:00
|
|
|
wrapProgram $out/bin/$name $wrapArgs
|
2015-11-21 13:56:56 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Script used to obtain source hashes for fetch${tool}";
|
|
|
|
maintainers = with maintainers; [ bennofs ];
|
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in rec {
|
|
|
|
nix-prefetch-bzr = mkPrefetchScript "bzr" ../../../build-support/fetchbzr/nix-prefetch-bzr [bazaar];
|
|
|
|
nix-prefetch-cvs = mkPrefetchScript "cvs" ../../../build-support/fetchcvs/nix-prefetch-cvs [cvs];
|
|
|
|
nix-prefetch-git = mkPrefetchScript "git" ../../../build-support/fetchgit/nix-prefetch-git [git coreutils];
|
|
|
|
nix-prefetch-hg = mkPrefetchScript "hg" ../../../build-support/fetchhg/nix-prefetch-hg [mercurial];
|
2015-12-11 18:31:00 +01:00
|
|
|
nix-prefetch-svn = mkPrefetchScript "svn" ../../../build-support/fetchsvn/nix-prefetch-svn [subversion.out];
|
|
|
|
nix-prefetch-zip = mkPrefetchScript "zip" ../../../build-support/fetchzip/nix-prefetch-zip [unzip curl.bin];
|
2015-11-21 13:56:56 +01:00
|
|
|
|
|
|
|
nix-prefetch-scripts = buildEnv {
|
|
|
|
name = "nix-prefetch-scripts";
|
|
|
|
|
|
|
|
paths = [ nix-prefetch-bzr nix-prefetch-cvs nix-prefetch-git nix-prefetch-hg nix-prefetch-svn nix-prefetch-zip ];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Collection of all the nix-prefetch-* scripts which may be used to obtain source hashes";
|
|
|
|
maintainers = with maintainers; [ bennofs ];
|
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
};
|
2014-06-10 17:36:41 +02:00
|
|
|
};
|
2014-06-21 05:05:48 +02:00
|
|
|
}
|