azure-cli: add generate-extensions routine
At nixpkgs, generate-extensions routine can be executed as: nix run .#azure-cli.passthru.generate-extensions
This commit is contained in:
parent
440922e97e
commit
db09ceb5bb
@ -19,13 +19,12 @@
|
||||
|
||||
## Extensions
|
||||
|
||||
There are two sets of extensions: the one in `extensions-generated.nix` is generated with the script
|
||||
`query-extension-index.sh`. These are extensions that don't have external requirements and thus can
|
||||
be easily maintained and updated. The set should only be manipulated through an update based on the
|
||||
script output.
|
||||
There are two sets of extensions:
|
||||
|
||||
The other set of extensions is in `extensions-manual.nix`. These are extensions with requirements,
|
||||
which need to be packaged and maintained manually.
|
||||
- `extensions-generated.nix` are extensions with no external requirements, which can be regenerated running:
|
||||
> nix run .#azure-cli.passthru.generate-extensions
|
||||
|
||||
- `extensions-manual.nix` are extensions with requirements, which need to be manually packaged and maintained.
|
||||
|
||||
### Adding an extension to `extensions-manual.nix`
|
||||
|
||||
|
@ -1,9 +1,4 @@
|
||||
# This file packages Azure CLI extensions that don't have any requirements.
|
||||
# Extensions with requirements should be placed in another file, so this one
|
||||
# can be re-generated during update.
|
||||
#
|
||||
# Attributes were generated using the query-extension-index.sh script:
|
||||
# ./query-extension-index.sh --requirements=false --download --nix --cli-version=<version>
|
||||
# This file is automatically generated. DO NOT EDIT! Read README.md
|
||||
{ mkAzExtension }:
|
||||
{
|
||||
account = mkAzExtension rec {
|
||||
|
@ -8,6 +8,7 @@
|
||||
runCommand,
|
||||
installShellFiles,
|
||||
python311,
|
||||
writeScriptBin,
|
||||
|
||||
# Whether to include patches that enable placing certain behavior-defining
|
||||
# configuration files in the Nix store.
|
||||
@ -375,6 +376,19 @@ py.pkgs.toPythonApplication (
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
generate-extensions = writeScriptBin "${pname}-update-extensions" ''
|
||||
export FILE=extensions-generated.nix
|
||||
echo "# This file is automatically generated. DO NOT EDIT! Read README.md" > $FILE
|
||||
echo "{ mkAzExtension }:" >> $FILE
|
||||
echo "{" >> $FILE
|
||||
${./query-extension-index.sh} --requirements=false --download --nix --cli-version=${version} \
|
||||
| xargs -n1 -d '\n' echo " " >> $FILE
|
||||
echo "" >> $FILE
|
||||
echo "}" >> $FILE
|
||||
echo "Extension was saved to \"extensions-generated.nix\" file."
|
||||
echo "Move it to \"{nixpkgs}/pkgs/by-name/az/azure-cli/extensions-generated.nix\"."
|
||||
'';
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
Loading…
Reference in New Issue
Block a user