at 25.11-pre 2.1 kB view raw
1{ 2 buildPythonApplication, 3 colorclass, 4 fetchPypi, 5 fetchurl, 6 installShellFiles, 7 lib, 8 linode-metadata, 9 openapi3, 10 packaging, 11 pyyaml, 12 requests, 13 rich, 14 setuptools, 15 terminaltables, 16}: 17 18let 19 hash = "sha256-QQxadKVEIh1PvD8FdYgJ/U1iyWdy6FvO+LUELQ70KKw="; 20 # specVersion taken from: https://www.linode.com/docs/api/openapi.yaml at `info.version`. 21 specVersion = "4.176.0"; 22 specHash = "sha256-P1E8Ga5ckrsw/CX0kxFef5fe8/p/pDCLuleX9wR5l48="; 23 spec = fetchurl { 24 url = "https://raw.githubusercontent.com/linode/linode-api-docs/v${specVersion}/openapi.yaml"; 25 hash = specHash; 26 }; 27 28in 29 30buildPythonApplication rec { 31 pname = "linode-cli"; 32 version = "5.56.2"; 33 pyproject = true; 34 35 src = fetchPypi { 36 pname = "linode_cli"; 37 inherit version; 38 hash = hash; 39 }; 40 41 patches = [ ./remove-update-check.patch ]; 42 43 # remove need for git history 44 prePatch = '' 45 substituteInPlace setup.py \ 46 --replace "version = get_version()" "version='${version}'," 47 ''; 48 49 postConfigure = '' 50 python3 -m linodecli bake ${spec} --skip-config 51 cp data-3 linodecli/ 52 echo "${version}" > baked_version 53 ''; 54 55 nativeBuildInputs = [ installShellFiles ]; 56 57 propagatedBuildInputs = [ 58 colorclass 59 linode-metadata 60 pyyaml 61 requests 62 setuptools 63 terminaltables 64 rich 65 openapi3 66 packaging 67 ]; 68 69 doInstallCheck = true; 70 installCheckPhase = '' 71 $out/bin/linode-cli --skip-config --version | grep ${version} > /dev/null 72 ''; 73 74 postInstall = '' 75 for shell in bash fish; do 76 installShellCompletion --cmd linode-cli \ 77 --$shell <($out/bin/linode-cli --skip-config completion $shell) 78 done 79 ''; 80 81 passthru.updateScript = ./update.sh; 82 83 meta = { 84 description = "Linode Command Line Interface"; 85 changelog = "https://github.com/linode/linode-cli/releases/tag/v${version}"; 86 downloadPage = "https://pypi.org/project/linode-cli"; 87 homepage = "https://github.com/linode/linode-cli"; 88 license = lib.licenses.bsd3; 89 maintainers = with lib.maintainers; [ 90 ryantm 91 techknowlogick 92 ]; 93 mainProgram = "linode-cli"; 94 }; 95}