forked from mirrors/nixpkgs
tp_smapi: updateScript added
This commit is contained in:
parent
3f206e34f2
commit
b7cfbf96d6
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,12 @@
|
|||
{stdenv, fetchurl, kernel}:
|
||||
{ stdenv, fetchurl, kernel, writeScript, coreutils, gnugrep, jq, curl
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "0.42";
|
||||
name = "tp_smapi-${version}-${kernel.version}";
|
||||
let
|
||||
data = stdenv.lib.importJSON ./update.json;
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "tp_smapi-${data.version}-${kernel.version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/evgeni/tp_smapi/releases/download/tp-smapi%2F0.42/tp_smapi-${version}.tgz";
|
||||
sha256 = "09rdg7fm423x6sbbw3lvnvmk4nyc33az8ar93xgq0n9qii49z3bv";
|
||||
};
|
||||
src = fetchurl { inherit (data) url sha256; };
|
||||
|
||||
hardeningDisable = [ "pic" ];
|
||||
|
||||
|
@ -25,6 +24,10 @@ stdenv.mkDerivation rec {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.updateScript = import ./update.nix {
|
||||
inherit writeScript coreutils gnugrep jq curl;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "IBM ThinkPad hardware functions driver";
|
||||
homepage = "https://github.com/evgeni/tp_smapi/tree/tp-smapi/0.41";
|
||||
|
|
5
pkgs/os-specific/linux/tp_smapi/update.json
Normal file
5
pkgs/os-specific/linux/tp_smapi/update.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"version": "0.42",
|
||||
"url": "https://github.com/evgeni/tp_smapi/archive/tp-smapi/0.42.tar.gz",
|
||||
"sha256": "cd28bf6ee21b2c27b88d947cb0bfcb19648c7daa5d350115403dbcad05849381"
|
||||
}
|
23
pkgs/os-specific/linux/tp_smapi/update.nix
Normal file
23
pkgs/os-specific/linux/tp_smapi/update.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ writeScript, coreutils, gnugrep, jq, curl
|
||||
}:
|
||||
|
||||
writeScript "update-tp_smapi" ''
|
||||
PATH=${coreutils}/bin:${gnugrep}/bin:${jq}/bin:${curl}/bin
|
||||
|
||||
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
|
||||
''
|
|
@ -48,12 +48,15 @@ let
|
|||
pkgs;
|
||||
|
||||
packageByName = name:
|
||||
if ! builtins.hasAttr name pkgs then
|
||||
let
|
||||
package = pkgs.lib.attrByPath (pkgs.lib.splitString "." name) null pkgs;
|
||||
in
|
||||
if package == null then
|
||||
builtins.throw "Package with an attribute name `${name}` does not exists."
|
||||
else if ! builtins.hasAttr "updateScript" (builtins.getAttr name pkgs) then
|
||||
else if ! builtins.hasAttr "updateScript" package then
|
||||
builtins.throw "Package with an attribute name `${name}` does have an `passthru.updateScript` defined."
|
||||
else
|
||||
builtins.getAttr name pkgs;
|
||||
package;
|
||||
|
||||
packages =
|
||||
if package != null then
|
||||
|
|
Loading…
Reference in a new issue