-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdefault.nix
61 lines (49 loc) · 1.72 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{ stdenv, lib, nix-gitignore, makeWrapper
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2, libxslt
, coreutils, gawk, gnugrep, gnused, jq, nix, git }:
with lib;
stdenv.mkDerivation rec {
pname = "nix-prefetch";
version = "0.4.1";
date = "2021-07-18";
src = nix-gitignore.gitignoreSource [ ".git" ] ./.;
nativeBuildInputs = [
makeWrapper
asciidoc docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
];
buildPhase = ''
a2x -f manpage doc/nix-prefetch.1.asciidoc
'';
installPhase = ''
lib=$out/lib/${pname}
mkdir -p $lib
substitute src/main.sh $lib/main.sh \
--subst-var-by lib $lib \
--subst-var-by version "$version"
chmod +x $lib/main.sh
patchShebangs $lib/main.sh
cp -r lib/. $lib/
mkdir -p $out/bin
makeWrapper $lib/main.sh $out/bin/${pname} \
--prefix PATH : '${makeBinPath [ coreutils gawk gnugrep gnused jq nix git ]}'
substitute src/tests.sh $lib/tests.sh \
--subst-var-by bin $out/bin
chmod +x $lib/tests.sh
patchShebangs $lib/tests.sh
mkdir -p $out/share/man/man1
substitute doc/nix-prefetch.1 $out/share/man/man1/nix-prefetch.1 \
--subst-var-by version "$version" \
--replace '01/01/1970' "$date"
install -D contrib/nix-prefetch-completion.bash $out/share/bash-completion/completions/nix-prefetch
install -D contrib/nix-prefetch-completion.zsh $out/share/zsh/site-functions/_nix_prefetch
mkdir $out/contrib
cp -r contrib/hello_rs $out/contrib/
'';
meta = {
description = "Prefetch any fetcher function call, e.g. package sources";
homepage = https://github.com/msteen/nix-prefetch;
license = licenses.mit;
maintainers = with maintainers; [ msteen ];
platforms = platforms.all;
};
}