84cb9d505d
GitOrigin-RevId: 51bcdc4cdaac48535dabf0ad4642a66774c609ed
73 lines
1.7 KiB
Nix
73 lines
1.7 KiB
Nix
{ lib
|
|
, fetchFromGitHub
|
|
, fetchurl
|
|
, buildPythonApplication
|
|
, colorclass
|
|
, installShellFiles
|
|
, pyyaml
|
|
, requests
|
|
, setuptools
|
|
, terminaltables
|
|
}:
|
|
|
|
let
|
|
sha256 = "08j7j9fpxh08vkczjqahb8r55bwks8p3ykrv6a2kfi309629nm96";
|
|
# specVersion taken from: https://www.linode.com/docs/api/openapi.yaml at `info.version`.
|
|
specVersion = "4.104.0";
|
|
specSha256 = "0lbky0djqsndp33067q6yir5525m3zcgkpvf1z16mkspkixzadqs";
|
|
spec = fetchurl {
|
|
url = "https://raw.githubusercontent.com/linode/linode-api-docs/v${specVersion}/openapi.yaml";
|
|
sha256 = specSha256;
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonApplication rec {
|
|
pname = "linode-cli";
|
|
version = "5.9.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "linode";
|
|
repo = pname;
|
|
rev = version;
|
|
inherit sha256;
|
|
};
|
|
|
|
# remove need for git history
|
|
prePatch = ''
|
|
substituteInPlace setup.py \
|
|
--replace "version=get_version()," "version='${version}',"
|
|
'';
|
|
|
|
propagatedBuildInputs = [
|
|
colorclass
|
|
pyyaml
|
|
requests
|
|
setuptools
|
|
terminaltables
|
|
];
|
|
|
|
postConfigure = ''
|
|
python3 -m linodecli bake ${spec} --skip-config
|
|
cp data-3 linodecli/
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
installCheckPhase = ''
|
|
$out/bin/linode-cli --skip-config --version | grep ${version} > /dev/null
|
|
'';
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
postInstall = ''
|
|
installShellCompletion --cmd linode-cli --bash <($out/bin/linode-cli --skip-config completion bash)
|
|
'';
|
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
meta = with lib; {
|
|
description = "The Linode Command Line Interface";
|
|
homepage = "https://github.com/linode/linode-cli";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ ryantm superherointj ];
|
|
};
|
|
}
|