Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, python3, fetchPypi, fetchFromGitHub, installShellFiles }: 2 3let 4 version = "2.52.0"; 5 6 src = fetchFromGitHub { 7 name = "azure-cli-${version}-src"; 8 owner = "Azure"; 9 repo = "azure-cli"; 10 rev = "azure-cli-${version}"; 11 hash = "sha256-wa0LmBMv3eQIsWEKMAHks+TvBZmTdFepPGG5XQRvZXk="; 12 }; 13 14 # put packages that needs to be overridden in the py package scope 15 py = import ./python-packages.nix { 16 inherit stdenv src version python3 fetchPypi; 17 }; 18in 19 20py.pkgs.toPythonApplication (py.pkgs.buildAzureCliPackage { 21 pname = "azure-cli"; 22 inherit version src; 23 24 sourceRoot = "${src.name}/src/azure-cli"; 25 26 prePatch = '' 27 substituteInPlace setup.py \ 28 --replace "chardet~=3.0.4" "chardet" \ 29 --replace "javaproperties~=0.5.1" "javaproperties" \ 30 --replace "scp~=0.13.2" "scp" \ 31 --replace "packaging>=20.9,<22.0" "packaging" \ 32 --replace "fabric~=2.4" "fabric" 33 34 # remove namespace hacks 35 # remove urllib3 because it was added as 'urllib3[secure]', which doesn't get handled well 36 sed -i setup.py \ 37 -e '/azure-cli-command_modules-nspkg/d' \ 38 -e '/azure-cli-nspkg/d' \ 39 -e '/urllib3/d' 40 ''; 41 42 nativeBuildInputs = [ installShellFiles ]; 43 44 propagatedBuildInputs = with py.pkgs; [ 45 azure-appconfiguration 46 azure-batch 47 azure-cli-core 48 azure-cli-telemetry 49 azure-cosmos 50 azure-data-tables 51 azure-datalake-store 52 azure-functions-devops-build 53 azure-graphrbac 54 azure-identity 55 azure-keyvault 56 azure-keyvault-administration 57 azure-keyvault-keys 58 azure-keyvault-certificates 59 azure-keyvault-secrets 60 azure-loganalytics 61 azure-mgmt-advisor 62 azure-mgmt-apimanagement 63 azure-mgmt-applicationinsights 64 azure-mgmt-appconfiguration 65 azure-mgmt-appcontainers 66 azure-mgmt-authorization 67 azure-mgmt-batch 68 azure-mgmt-batchai 69 azure-mgmt-billing 70 azure-mgmt-botservice 71 azure-mgmt-cdn 72 azure-mgmt-cognitiveservices 73 azure-mgmt-compute 74 azure-mgmt-consumption 75 azure-mgmt-containerinstance 76 azure-mgmt-containerregistry 77 azure-mgmt-containerservice 78 azure-mgmt-cosmosdb 79 azure-mgmt-databoxedge 80 azure-mgmt-datalake-analytics 81 azure-mgmt-datalake-store 82 azure-mgmt-datamigration 83 azure-mgmt-deploymentmanager 84 azure-mgmt-devtestlabs 85 azure-mgmt-dns 86 azure-mgmt-eventgrid 87 azure-mgmt-eventhub 88 azure-mgmt-extendedlocation 89 azure-mgmt-hdinsight 90 azure-mgmt-imagebuilder 91 azure-mgmt-iotcentral 92 azure-mgmt-iothub 93 azure-mgmt-iothubprovisioningservices 94 azure-mgmt-keyvault 95 azure-mgmt-kusto 96 azure-mgmt-loganalytics 97 azure-mgmt-managedservices 98 azure-mgmt-managementgroups 99 azure-mgmt-maps 100 azure-mgmt-marketplaceordering 101 azure-mgmt-media 102 azure-mgmt-monitor 103 azure-mgmt-msi 104 azure-mgmt-network 105 azure-mgmt-netapp 106 azure-mgmt-policyinsights 107 azure-mgmt-privatedns 108 azure-mgmt-rdbms 109 azure-mgmt-recoveryservices 110 azure-mgmt-recoveryservicesbackup 111 azure-mgmt-redhatopenshift 112 azure-mgmt-redis 113 azure-mgmt-relay 114 azure-mgmt-reservations 115 azure-mgmt-resource 116 azure-mgmt-search 117 azure-mgmt-security 118 azure-mgmt-servicebus 119 azure-mgmt-servicefabric 120 azure-mgmt-servicefabricmanagedclusters 121 azure-mgmt-servicelinker 122 azure-mgmt-signalr 123 azure-mgmt-sql 124 azure-mgmt-sqlvirtualmachine 125 azure-mgmt-storage 126 azure-mgmt-synapse 127 azure-mgmt-trafficmanager 128 azure-mgmt-web 129 azure-multiapi-storage 130 azure-storage-blob 131 azure-synapse-accesscontrol 132 azure-synapse-artifacts 133 azure-synapse-managedprivateendpoints 134 azure-synapse-spark 135 chardet 136 colorama 137 cryptography 138 distro 139 fabric 140 jsmin 141 knack 142 mock 143 paramiko 144 pydocumentdb 145 pygithub 146 pygments 147 pynacl 148 pyopenssl 149 pytz 150 pyyaml 151 psutil 152 requests 153 scp 154 semver 155 six 156 sshtunnel 157 urllib3 158 vsts-cd-manager 159 websocket-client 160 xmltodict 161 javaproperties 162 jsondiff 163 # urllib3[secure] 164 # shell completion 165 argcomplete 166 ]; 167 168 postInstall = '' 169 substituteInPlace az.completion.sh \ 170 --replace register-python-argcomplete ${py.pkgs.argcomplete}/bin/register-python-argcomplete 171 installShellCompletion --bash --name az.bash az.completion.sh 172 installShellCompletion --zsh --name _az az.completion.sh 173 174 # remove garbage 175 rm $out/bin/az.bat 176 rm $out/bin/az.completion.sh 177 ''; 178 179 # wrap the executable so that the python packages are available 180 # it's just a shebang script which calls `python -m azure.cli "$@"` 181 postFixup = '' 182 wrapProgram $out/bin/az \ 183 --set PYTHONPATH $PYTHONPATH 184 ''; 185 186 # almost the entire test suite requires an azure account setup and networking 187 # ensure that the azure namespaces are setup correctly and that azure.cli can be accessed 188 checkPhase = '' 189 HOME=$TMPDIR $out/bin/az --help > /dev/null 190 ''; 191 192 # ensure these namespaces are able to be accessed 193 pythonImportsCheck = [ 194 "azure.batch" 195 "azure.cli.core" 196 "azure.cli.telemetry" 197 "azure.cosmos" 198 "azure.datalake.store" 199 "azure_functions_devops_build" 200 "azure.graphrbac" 201 "azure.keyvault" 202 "azure.loganalytics" 203 "azure.mgmt.advisor" 204 "azure.mgmt.apimanagement" 205 "azure.mgmt.applicationinsights" 206 "azure.mgmt.appconfiguration" 207 "azure.mgmt.appcontainers" 208 "azure.mgmt.authorization" 209 "azure.mgmt.batch" 210 "azure.mgmt.batchai" 211 "azure.mgmt.billing" 212 "azure.mgmt.botservice" 213 "azure.mgmt.cdn" 214 "azure.mgmt.cognitiveservices" 215 "azure.mgmt.compute" 216 "azure.mgmt.consumption" 217 "azure.mgmt.containerinstance" 218 "azure.mgmt.containerregistry" 219 "azure.mgmt.containerservice" 220 "azure.mgmt.cosmosdb" 221 "azure.mgmt.datalake.analytics" 222 "azure.mgmt.datalake.store" 223 "azure.mgmt.datamigration" 224 "azure.mgmt.deploymentmanager" 225 "azure.mgmt.devtestlabs" 226 "azure.mgmt.dns" 227 "azure.mgmt.eventgrid" 228 "azure.mgmt.eventhub" 229 "azure.mgmt.hdinsight" 230 "azure.mgmt.imagebuilder" 231 "azure.mgmt.iotcentral" 232 "azure.mgmt.iothub" 233 "azure.mgmt.iothubprovisioningservices" 234 "azure.mgmt.keyvault" 235 "azure.mgmt.kusto" 236 "azure.mgmt.loganalytics" 237 "azure.mgmt.managedservices" 238 "azure.mgmt.managementgroups" 239 "azure.mgmt.maps" 240 "azure.mgmt.marketplaceordering" 241 "azure.mgmt.media" 242 "azure.mgmt.monitor" 243 "azure.mgmt.msi" 244 "azure.mgmt.network" 245 "azure.mgmt.netapp" 246 "azure.mgmt.policyinsights" 247 "azure.mgmt.privatedns" 248 "azure.mgmt.rdbms" 249 "azure.mgmt.recoveryservices" 250 "azure.mgmt.recoveryservicesbackup" 251 "azure.mgmt.redis" 252 "azure.mgmt.relay" 253 "azure.mgmt.reservations" 254 "azure.mgmt.resource" 255 "azure.mgmt.search" 256 "azure.mgmt.security" 257 "azure.mgmt.servicebus" 258 "azure.mgmt.servicefabric" 259 "azure.mgmt.signalr" 260 "azure.mgmt.sql" 261 "azure.mgmt.sqlvirtualmachine" 262 "azure.mgmt.storage" 263 "azure.mgmt.trafficmanager" 264 "azure.mgmt.web" 265 "azure.storage.blob" 266 "azure.storage.common" 267 ]; 268 269 meta = with lib; { 270 homepage = "https://github.com/Azure/azure-cli"; 271 description = "Next generation multi-platform command line experience for Azure"; 272 downloadPage = "https://github.com/Azure/azure-cli/releases/tag/azure-cli-${version}"; 273 longDescription = '' 274 The Azure Command-Line Interface (CLI) is a cross-platform 275 command-line tool to connect to Azure and execute administrative 276 commands on Azure resources. It allows the execution of commands 277 through a terminal using interactive command-line prompts or a script. 278 ''; 279 changelog = "https://github.com/MicrosoftDocs/azure-docs-cli/blob/main/docs-ref-conceptual/release-notes-azure-cli.md"; 280 sourceProvenance = [ sourceTypes.fromSource ]; 281 license = licenses.mit; 282 mainProgram = "az"; 283 maintainers = with maintainers; [ akechishiro jonringer ]; 284 platforms = platforms.all; 285 }; 286}) 287