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