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