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 {
|
let
|
||||||
version = "0.42";
|
data = stdenv.lib.importJSON ./update.json;
|
||||||
name = "tp_smapi-${version}-${kernel.version}";
|
in stdenv.mkDerivation rec {
|
||||||
|
name = "tp_smapi-${data.version}-${kernel.version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl { inherit (data) url sha256; };
|
||||||
url = "https://github.com/evgeni/tp_smapi/releases/download/tp-smapi%2F0.42/tp_smapi-${version}.tgz";
|
|
||||||
sha256 = "09rdg7fm423x6sbbw3lvnvmk4nyc33az8ar93xgq0n9qii49z3bv";
|
|
||||||
};
|
|
||||||
|
|
||||||
hardeningDisable = [ "pic" ];
|
hardeningDisable = [ "pic" ];
|
||||||
|
|
||||||
@ -25,6 +24,10 @@ stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
passthru.updateScript = import ./update.nix {
|
||||||
|
inherit writeScript coreutils gnugrep jq curl;
|
||||||
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "IBM ThinkPad hardware functions driver";
|
description = "IBM ThinkPad hardware functions driver";
|
||||||
homepage = "https://github.com/evgeni/tp_smapi/tree/tp-smapi/0.41";
|
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;
|
pkgs;
|
||||||
|
|
||||||
packageByName = name:
|
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."
|
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."
|
builtins.throw "Package with an attribute name `${name}` does have an `passthru.updateScript` defined."
|
||||||
else
|
else
|
||||||
builtins.getAttr name pkgs;
|
package;
|
||||||
|
|
||||||
packages =
|
packages =
|
||||||
if package != null then
|
if package != null then
|
||||||
|
Loading…
Reference in New Issue
Block a user