nix-prefetch: modernize
This commit is contained in:
@@ -3,31 +3,38 @@
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
installShellFiles,
|
||||
makeWrapper,
|
||||
|
||||
# nativeBuildInputs
|
||||
asciidoc,
|
||||
docbook_xml_dtd_45,
|
||||
git,
|
||||
docbook_xsl,
|
||||
installShellFiles,
|
||||
libxml2,
|
||||
libxslt,
|
||||
makeWrapper,
|
||||
|
||||
# wrapper
|
||||
coreutils,
|
||||
gawk,
|
||||
gitMinimal,
|
||||
gnugrep,
|
||||
gnused,
|
||||
jq,
|
||||
nix,
|
||||
|
||||
versionCheckHook,
|
||||
gitUpdater,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "nix-prefetch";
|
||||
version = "0.4.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "msteen";
|
||||
repo = "nix-prefetch";
|
||||
rev = version;
|
||||
sha256 = "0bwv6x651gyq703pywrhb7lfby6xwnd1iwnrzzjihipn7x3v2hz9";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-6UOxRz/2Rhjl/9nyGJrl3fjl6Fkwc38HONi/UEw3my8=";
|
||||
# the stat call has to be in a subshell or we get the current date
|
||||
postFetch = ''
|
||||
echo $(stat -c %Y $out) > $out/.timestamp
|
||||
@@ -43,7 +50,7 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
lib=$out/lib/${pname}
|
||||
lib=$out/lib/nix-prefetch
|
||||
|
||||
substituteInPlace doc/nix-prefetch.1.asciidoc \
|
||||
--subst-var-by version $version
|
||||
@@ -76,12 +83,12 @@ stdenv.mkDerivation rec {
|
||||
installPhase = ''
|
||||
install -Dm555 -t $lib src/*.sh
|
||||
install -Dm444 -t $lib lib/*
|
||||
makeWrapper $lib/main.sh $out/bin/${pname} \
|
||||
makeWrapper $lib/main.sh $out/bin/nix-prefetch \
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath [
|
||||
coreutils
|
||||
gawk
|
||||
git
|
||||
gitMinimal
|
||||
gnugrep
|
||||
gnused
|
||||
jq
|
||||
@@ -91,18 +98,29 @@ stdenv.mkDerivation rec {
|
||||
|
||||
installManPage doc/nix-prefetch.?
|
||||
|
||||
installShellCompletion --name ${pname} contrib/nix-prefetch-completion.{bash,zsh}
|
||||
installShellCompletion --name nix-prefetch contrib/nix-prefetch-completion.{bash,zsh}
|
||||
|
||||
mkdir -p $out/share/doc/${pname}/contrib
|
||||
cp -r contrib/hello_rs $out/share/doc/${pname}/contrib
|
||||
mkdir -p $out/share/doc/nix-prefetch/contrib
|
||||
cp -r contrib/hello_rs $out/share/doc/nix-prefetch/contrib
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
];
|
||||
versionCheckProgramArg = [ "--version" ];
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru = {
|
||||
updateScript = gitUpdater { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Prefetch any fetcher function call, e.g. package sources";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ msteen ];
|
||||
homepage = "https://github.com/msteen/nix-prefetch";
|
||||
platforms = platforms.all;
|
||||
changelog = "https://github.com/msteen/nix-prefetch/blob/${finalAttrs.version}/CHANGELOG.md";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ msteen ];
|
||||
platforms = lib.platforms.all;
|
||||
mainProgram = "nix-prefetch";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user