Bug: Azure CLI extensions from Nix packages are not discoverable in devbox shell
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by tracing how Devbox configures package environments and launches commands in the shell, then inspect the Nix wrapper for az and how it handles PYTHONPATH. Reproduce with the listed azure-cli and extension packages and run az extension list; done means the declaratively installed extension is discovered in the Devbox shell.
由索引模型根据 Issue 内容生成。
描述
What happened?
When managing azure-cli and its extensions declaratively in devbox.json, the az command is unable to discover the extensions, even though the package files are correctly installed in the Nix profile.
This seems to be caused by the Nix wrapper for the az executable, which appears to create an isolated Python environment, ignoring the PYTHONPATH from the parent devbox shell. This prevents the Azure CLI's standard site-packages auto-discovery from working.
This contrasts with other ecosystems like helm, where setting a HELM_PLUGINS environment variable works as expected. The equivalent AZURE_EXTENSION_DIR does not work here because the Nix package for the extension installs it as a Python module (azext_*) rather than in a separate directory structure.
Steps to reproduce
-
Create a new directory and run
devbox init. -
Set the
devbox.jsonto the following content:{ "packages": [ "[email protected]", "[email protected]" ] } -
Start the shell with
devbox shell. -
Run the command to list extensions:
az extension list -
(Optional) Confirm the extension's files are present in the environment's
site-packages:# Path may vary slightly based on python version ls .devbox/nix/profile/default/lib/python3.13/site-packages/
This will show azext_log_analytics_solution@ and other related files, proving the package was installed by Devbox.
Expected behavior
The az extension list command should discover and list the log-analytics-solution extension, similar to this output:
Name Version State Type
----------------------- --------- -------- ------
log-analytics-solution 1.0.1 Enabled whl
Actual behavior
The az extension list command returns an empty list, and commands provided by the extension (e.g., az log-analytics-solution) are not found.
Analysis of the Cause
Debug logs from az extension list --debug show that the CLI never attempts to load extensions from any directory (~/.azure/cliextensions, site-packages, or a path from AZURE_EXTENSION_DIR). It seems the Nix wrapper script for az sanitizes the PYTHONPATH, breaking the auto-discovery mechanism that relies on finding azext_* modules.
Workaround
The current pragmatic workaround is to abandon the declarative management of extensions and use the imperative approach:
-
Only include the core
azure-cliindevbox.json.{ "packages": ["[email protected]"] } -
Inside the
devbox shell, manually install the extension.az extension add --name log-analytics-solution
This works because it installs the extension into ~/.azure/cliextensions, a path the az wrapper knows how to check.
Command
No response
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.17.1/.schema/devbox.schema.json",
"packages": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
],
"shell": {
"init_hook": [
"export SOPS_AGE_KEY_FILE=$(pwd)/.age.agekey"
]
}
}
Devbox version
0.17.1
Nix version
nix (Determinate Nix 3.17.3) 2.33.3
What system does this bug occur on?
macOS (Apple Silicon)
Debug logs
No response
- 主要语言
- Go
- 星标
- 12.4k
- 派生
- 358
- 平均合并
- 17 小时 12 分钟
- 30 天内合并 PR
- 31
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
jetify-com/devbox 的其他 Issue
-
feature triage
难度 2/5 1-3 小时 新手友好度 62/100
jetify-com/devbox#3038 ·
维护者通常 1 天内回复
-
bug p4 package processed triage unrelated
难度 2/5 1-3 小时 新手友好度 66/100
jetify-com/devbox#2898 · 2 条评论 ·
维护者通常 1 天内回复
-
p4 processed unrelated
难度 2/5 1-3 小时 新手友好度 65/100
jetify-com/devbox#2750 · 1 条评论 ·
维护者通常 1 天内回复
-
Storyden未关闭p4 package processed triage unrelated
难度 2/5 1-3 小时 新手友好度 62/100
jetify-com/devbox#2685 · 1 条评论 ·
维护者通常 1 天内回复
-
looks easy p4 package processed triage
难度 2/5 1-3 小时 新手友好度 60/100
jetify-com/devbox#2656 · 1 条评论 ·
维护者通常 1 天内回复
查看 jetify-com/devbox 的全部 Issue
相似的 Issue
-
component:obi contribfest go test
难度 2/5 1 小时以内 新手友好度 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4143 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
area/ambient
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
kind/cleanup
难度 2/5 1-3 小时 新手友好度 68/100
kubernetes-sigs/kueue#18324 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 84/100