1{
2 lib,
3 stdenv,
4 makeWrapper,
5 buildEnv,
6 bash,
7 breezy,
8 cacert,
9 coreutils,
10 cvs,
11 darcs,
12 findutils,
13 gawk,
14 gitMinimal,
15 git-lfs,
16 gnused,
17 jq,
18 mercurial,
19 pijul,
20 subversion,
21}:
22
23let
24 mkPrefetchScript =
25 tool: src: deps:
26 stdenv.mkDerivation {
27 name = "nix-prefetch-${tool}";
28
29 strictDeps = true;
30 nativeBuildInputs = [ makeWrapper ];
31 buildInputs = [ bash ];
32
33 dontUnpack = true;
34
35 installPhase = ''
36 install -vD ${src} $out/bin/$name;
37 wrapProgram $out/bin/$name \
38 --prefix PATH : ${
39 lib.makeBinPath (
40 deps
41 ++ [
42 coreutils
43 gnused
44 ]
45 )
46 } \
47 --set HOME /homeless-shelter
48 '';
49
50 preferLocalBuild = true;
51
52 meta = with lib; {
53 description = "Script used to obtain source hashes for fetch${tool}";
54 maintainers = with maintainers; [ bennofs ];
55 platforms = platforms.unix;
56 mainProgram = "nix-prefetch-${tool}";
57 };
58 };
59in
60rec {
61 # No explicit dependency on Nix, as these can be used inside builders,
62 # and thus will cause dependency loops. When used _outside_ builders,
63 # we expect people to have a Nix implementation available ambiently.
64 nix-prefetch-bzr = mkPrefetchScript "bzr" ../../../build-support/fetchbzr/nix-prefetch-bzr [
65 breezy
66 ];
67 nix-prefetch-cvs = mkPrefetchScript "cvs" ../../../build-support/fetchcvs/nix-prefetch-cvs [ cvs ];
68 nix-prefetch-darcs = mkPrefetchScript "darcs" ../../../build-support/fetchdarcs/nix-prefetch-darcs [
69 darcs
70 cacert
71 jq
72 ];
73 nix-prefetch-git = mkPrefetchScript "git" ../../../build-support/fetchgit/nix-prefetch-git [
74 findutils
75 gawk
76 gitMinimal
77 git-lfs
78 ];
79 nix-prefetch-hg = mkPrefetchScript "hg" ../../../build-support/fetchhg/nix-prefetch-hg [
80 mercurial
81 ];
82 nix-prefetch-svn = mkPrefetchScript "svn" ../../../build-support/fetchsvn/nix-prefetch-svn [
83 subversion
84 ];
85 nix-prefetch-pijul = mkPrefetchScript "pijul" ../../../build-support/fetchpijul/nix-prefetch-pijul [
86 pijul
87 cacert
88 jq
89 ];
90
91 nix-prefetch-scripts = buildEnv {
92 name = "nix-prefetch-scripts";
93
94 paths = [
95 nix-prefetch-bzr
96 nix-prefetch-cvs
97 nix-prefetch-darcs
98 nix-prefetch-git
99 nix-prefetch-hg
100 nix-prefetch-svn
101 nix-prefetch-pijul
102 ];
103
104 meta = with lib; {
105 description = "Collection of all the nix-prefetch-* scripts which may be used to obtain source hashes";
106 maintainers = with maintainers; [ bennofs ];
107 platforms = platforms.unix;
108 };
109 };
110}