diff options
author | Tuomas Tynkkynen <tuomas@tuxera.com> | 2017-02-19 16:33:31 +0200 |
---|---|---|
committer | Tuomas Tynkkynen <tuomas@tuxera.com> | 2017-02-19 16:51:17 +0200 |
commit | 9483359887f815aa7441176be5af2d4e9ae6f5b2 (patch) | |
tree | b79e6f46c78fdb68a955c7097617cce44f2091f1 /pkgs/os-specific/linux/tp_smapi | |
parent | b53c53b1b4dd30d4c28ed86ec4f6c49079de4f66 (diff) | |
download | nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar.gz nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar.bz2 nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar.lz nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar.xz nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.tar.zst nixpkgs-9483359887f815aa7441176be5af2d4e9ae6f5b2.zip |
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.
Diffstat (limited to 'pkgs/os-specific/linux/tp_smapi')
-rw-r--r-- | pkgs/os-specific/linux/tp_smapi/default.nix | 14 | ||||
-rw-r--r-- | pkgs/os-specific/linux/tp_smapi/update.nix | 19 |
2 files changed, 11 insertions, 22 deletions
diff --git a/pkgs/os-specific/linux/tp_smapi/default.nix b/pkgs/os-specific/linux/tp_smapi/default.nix index cb5c539a94e..765305d0fda 100644 --- a/pkgs/os-specific/linux/tp_smapi/default.nix +++ b/pkgs/os-specific/linux/tp_smapi/default.nix @@ -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 = { diff --git a/pkgs/os-specific/linux/tp_smapi/update.nix b/pkgs/os-specific/linux/tp_smapi/update.nix index 0c97d18472c..94eb44b744c 100644 --- a/pkgs/os-specific/linux/tp_smapi/update.nix +++ b/pkgs/os-specific/linux/tp_smapi/update.nix @@ -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" '' |