-
Notifications
You must be signed in to change notification settings - Fork 426
Add --option CLI flag for overriding configuration options #1838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Given the task model, why not natively support the concept of matrix/parallel within devenv? E.g. in the interest of reproducibility I would want to run a 'matrix task' via devenv not require some sort of shell wrapper to reproduce locally |
I'd like to support matrix within devenv and has always been the plan, but this is more of a quick way to be able to write scripts using devenv and for testing quick changes. |
Then i may suggest ENV var support (alternatively/in-addition-to) than building cli arguments -- given that the expectation that it will be 'for CI' it's much easier/the default to set specific variables than deal with command construction imo. I am also confused on how one may refer to the different package versions if they're not explicitly packaged via nixpkgs -- e.g. the normal way one has multiple versions may require overlays, say:
What would the value of the pkg option be then? |
f30a95c
to
0fdc00b
Compare
I've changed the design to always require specifying the type:
|
It requires to specify the infered Nix type: --option languages.redis.enable:bool true This is usefor for temporary changing the configuration, like testing a matrix of options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new CLI flag (--option) to allow overriding configuration options for building matrix on CI jobs. Key changes include:
- Adding a sample YAML file in tests/cli-options for CLI options.
- Updating documentation in docs/basics.md with a new section on how to use the --option flag.
- Implementing the logic for parsing and writing CLI options in devenv/src/devenv.rs, along with corresponding updates to CLI parsing and file watching in cnix.rs and cli.rs.
Reviewed Changes
Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/cli-options/devenv.yaml | Added sample configuration inputs for testing CLI options. |
docs/basics.md | Expanded documentation to include instructions for using the --option flag. |
devenv/src/devenv.rs | Implemented CLI options processing and writing to cli-options.nix. |
devenv/src/cnix.rs | Updated file watching to include cli-options.nix. |
devenv/src/cli.rs | Added new CLI flag definition for --option. |
Files not reviewed (3)
- devenv/src/flake.tmpl.nix: Language not supported
- tests/cli-options/.test.sh: Language not supported
- tests/cli-options/devenv.nix: Language not supported
Comments suppressed due to low confidence (1)
devenv/src/devenv.rs:895
- Using chunks_exact(2) may silently ignore a trailing CLI option if an odd number of values is provided. Consider validating that the total number of --option arguments is even before processing.
for chunk in self.global_options.option.chunks_exact(2) {
It's common to be able to build matrix on CI jobs, so let's allow passing options via CLI:
cc @staticdev