1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 22:50:49 +00:00

nix-prefetch: 0.3.0 -> 0.3.1 (#85367)

* nix-prefetch: 0.3.0 -> 0.3.1

* nix-prefetch: date in man page

* nix-prefetch: use UTC
This commit is contained in:
Peter Hoeg 2020-04-17 21:10:24 +08:00 committed by GitHub
parent 056778b315
commit 52c06182eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,67 +1,74 @@
{ stdenv, fetchFromGitHub, makeWrapper { stdenv, fetchFromGitHub, installShellFiles, makeWrapper, asciidoc
, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2, libxslt , docbook_xml_dtd_45, git, docbook_xsl, libxml2, libxslt, coreutils, gawk
, coreutils, gawk, gnugrep, gnused, jq, nix }: , gnugrep, gnused, jq, nix }:
stdenv.mkDerivation rec { let
binPath = stdenv.lib.makeBinPath [ coreutils gawk git gnugrep gnused jq nix ];
in stdenv.mkDerivation rec {
pname = "nix-prefetch"; pname = "nix-prefetch";
version = "0.3.0"; version = "0.3.1";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "msteen"; owner = "msteen";
repo = "nix-prefetch"; repo = "nix-prefetch";
rev = version; rev = version;
sha256 = "0b9gdi7xzmfq0j258x724xsll8gi31m0m4pzfjkqinlm6zwr3sgm"; sha256 = "15h6f743nn6sdq8l771sjxh92cyzqznkcs7szrc7nm066xvx8rd4";
# the stat call has to be in a subshell or we get the current date
extraPostFetch = ''
echo $(stat -c %Y $out) > $out/.timestamp
'';
}; };
nativeBuildInputs = [ postPatch = ''
makeWrapper lib=$out/lib/${pname}
asciidoc docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
];
configurePhase = '' substituteInPlace doc/nix-prefetch.1.asciidoc \
. configure.sh --subst-var-by version $version
substituteInPlace src/main.sh \
--subst-var-by lib $lib \
--subst-var-by version $version
substituteInPlace src/tests.sh \
--subst-var-by bin $out/bin
''; '';
nativeBuildInputs = [
asciidoc
docbook_xml_dtd_45
docbook_xsl
installShellFiles
libxml2
libxslt
makeWrapper
];
dontConfigure = true;
buildPhase = '' buildPhase = ''
a2x -f manpage doc/nix-prefetch.1.asciidoc a2x -a revdate=$(date --utc --date=@$(cat $src/.timestamp) +%d/%m/%Y) \
-f manpage doc/nix-prefetch.1.asciidoc
''; '';
installPhase = '' installPhase = ''
lib=$out/lib/${pname} install -Dm555 -t $lib src/*.sh
mkdir -p $lib install -Dm444 -t $lib 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 lib/*.nix $lib/
mkdir -p $out/bin
makeWrapper $lib/main.sh $out/bin/${pname} \ makeWrapper $lib/main.sh $out/bin/${pname} \
--prefix PATH : '${stdenv.lib.makeBinPath [ coreutils gawk gnugrep gnused jq nix ]}' --prefix PATH : ${binPath}
substitute src/tests.sh $lib/tests.sh \ installManPage doc/nix-prefetch.?
--subst-var-by bin $out/bin
chmod +x $lib/tests.sh
patchShebangs $lib/tests.sh
mkdir -p $out/share/man/man1 installShellCompletion --name ${pname} contrib/nix-prefetch-completion.{bash,zsh}
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 -p $out/share/doc/${pname}/contrib mkdir -p $out/share/doc/${pname}/contrib
cp -r contrib/hello_rs $out/share/doc/${pname}/contrib/ cp -r contrib/hello_rs $out/share/doc/${pname}/contrib
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Prefetch any fetcher function call, e.g. package sources"; description = "Prefetch any fetcher function call, e.g. package sources";
homepage = "https://github.com/msteen/nix-prefetch";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ msteen ]; maintainers = with maintainers; [ msteen ];
platforms = platforms.all; inherit (src.meta) homepage;
}; };
} }