1 { lib, stdenv, fetchFromGitHub, fetchpatch, installShellFiles, makeWrapper, asciidoc
2 , docbook_xml_dtd_45, git, docbook_xsl, libxml2, libxslt, coreutils, gawk
3 , gnugrep, gnused, jq, nix }:
5 stdenv.mkDerivation rec {
6 pname = "nix-prefetch";
9 src = fetchFromGitHub {
11 repo = "nix-prefetch";
13 sha256 = "0bwv6x651gyq703pywrhb7lfby6xwnd1iwnrzzjihipn7x3v2hz9";
14 # the stat call has to be in a subshell or we get the current date
16 echo $(stat -c %Y $out) > $out/.timestamp
22 name = "fix-prefetching-hash-key.patch";
23 url = "https://github.com/msteen/nix-prefetch/commit/508237f48f7e2d8496ce54f38abbe57f44d0cbca.patch";
24 hash = "sha256-9SYPcRFZaVyNjMUVdXbef5eGvLp/kr379eU9lG5GgE0=";
31 substituteInPlace doc/nix-prefetch.1.asciidoc \
32 --subst-var-by version $version
34 substituteInPlace src/main.sh \
35 --subst-var-by lib $lib \
36 --subst-var-by version $version
38 substituteInPlace src/tests.sh \
39 --subst-var-by bin $out/bin
55 a2x -a revdate=$(date --utc --date=@$(cat $src/.timestamp) +%d/%m/%Y) \
56 -f manpage doc/nix-prefetch.1.asciidoc
60 install -Dm555 -t $lib src/*.sh
61 install -Dm444 -t $lib lib/*
62 makeWrapper $lib/main.sh $out/bin/${pname} \
63 --prefix PATH : ${lib.makeBinPath [ coreutils gawk git gnugrep gnused jq nix ]}
65 installManPage doc/nix-prefetch.?
67 installShellCompletion --name ${pname} contrib/nix-prefetch-completion.{bash,zsh}
69 mkdir -p $out/share/doc/${pname}/contrib
70 cp -r contrib/hello_rs $out/share/doc/${pname}/contrib
74 description = "Prefetch any fetcher function call, e.g. package sources";
75 license = licenses.mit;
76 maintainers = with maintainers; [ msteen ];
77 homepage = "https://github.com/msteen/nix-prefetch";
78 platforms = platforms.all;