linuxPackages.tp_smapi: Use common-updater/update-source-version script
This way we have the benefit of the usual Nixpkgs style, and gain a slight reduction in amount of code in the updater. Also use callPackage to reduce duplication of the dependencies of the update script and use makeBinPath to make things neater.
This commit is contained in:
parent
b53c53b1b4
commit
9483359887
@ -1,14 +1,16 @@
|
||||
{ stdenv, fetchurl, kernel, writeScript, coreutils, gnugrep, jq, curl
|
||||
{ stdenv, lib, fetchFromGitHub, kernel, writeScript, coreutils, gnugrep, jq, curl, common-updater-scripts
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "tp_smapi-${version}-${kernel.version}";
|
||||
|
||||
version = "0.42";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/evgeni/tp_smapi/archive/tp-smapi/${version}.tar.gz";
|
||||
sha256 = "cd28bf6ee21b2c27b88d947cb0bfcb19648c7daa5d350115403dbcad05849381";
|
||||
src = fetchFromGitHub {
|
||||
owner = "evgeni";
|
||||
repo = "tp_smapi";
|
||||
rev = "tp-smapi/${version}";
|
||||
sha256 = "12lnig90lrmkmqwl386q7ssqs9p0jikqhwl2wsmcmii1gn92hzfy";
|
||||
name = "tp-smapi-${version}";
|
||||
};
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
@ -28,7 +30,7 @@ stdenv.mkDerivation rec {
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.updateScript = import ./update.nix {
|
||||
inherit writeScript coreutils gnugrep jq curl;
|
||||
inherit lib writeScript coreutils gnugrep jq curl common-updater-scripts;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
@ -1,23 +1,10 @@
|
||||
{ writeScript, coreutils, gnugrep, jq, curl
|
||||
}:
|
||||
{ lib, writeScript, coreutils, curl, gnugrep, jq, common-updater-scripts }:
|
||||
|
||||
writeScript "update-tp_smapi" ''
|
||||
PATH=${coreutils}/bin:${gnugrep}/bin:${jq}/bin:${curl}/bin
|
||||
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep jq ]}
|
||||
|
||||
pushd pkgs/os-specific/linux/tp_smapi
|
||||
|
||||
tmpfile=`mktemp`
|
||||
tags=`curl -s https://api.github.com/repos/evgeni/tp_smapi/tags`
|
||||
latest_tag=`echo $tags | jq -r '.[] | .name' | grep -oP "^tp-smapi/\K.*" | sort --version-sort | tail -1`
|
||||
sha256=`curl -sL "https://github.com/evgeni/tp_smapi/archive/tp-smapi/$latest_tag.tar.gz" | sha256sum | cut -d" " -f1`
|
||||
|
||||
cat > update.json <<EOF
|
||||
{
|
||||
"version": "$latest_tag",
|
||||
"url": "https://github.com/evgeni/tp_smapi/archive/tp-smapi/$latest_tag.tar.gz",
|
||||
"sha256": "$sha256"
|
||||
}
|
||||
EOF
|
||||
|
||||
popd
|
||||
update-source-version linuxPackages.tp_smapi "$latest_tag"
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user