Repository navigation
Conversation
Add --headless flag that accepts defaults for all prompts except URL, enabling automation and CI/CD integration. When --headless is enabled: - URL must be provided via --url (required) - Package name must be auto-detected or provided - Build type uses first auto-detected option - Output path defaults to current directory - Submodule fetching skipped by default - File overwrite protection (errors instead of prompting) Future commits will add flags to customize behavior in headless mode.
Introduce a macro to handle the repetitive pattern of: - Use flag value if provided - Use default value in headless mode - Prompt user in interactive mode Apply the macro to URL handling, replacing the early validation with a more idiomatic error in the default branch. This pattern will be used for all subsequent flag additions.
Add --rev flag to specify the git revision, tag, or commit hash from the command line, making version selection non-interactive. Uses the flag_or_prompt macro to integrate with headless mode, falling back to the default revision in headless mode when not specified.
Add new --pname/-p CLI flag that allows users to specify the package name directly. Refactor pname handling to use flag_or_prompt! macro for consistent behavior between headless and interactive modes.
Add --build flag to specify the build type from the command line, making build system selection non-interactive. Accepts short flag values: go-mod (buildGoModule) python-app (buildPythonApplication) python-pkg (buildPythonPackage) rust-pkg (buildRustPackage) drv (stdenv.mkDerivation) Validates against detected options and provides clear error messages listing available choices. In headless mode without --build, defaults to the first auto-detected build type.
Add --version/-v flag to specify the package version from the command line, allowing users to override auto-detected versions. Uses the flag_or_prompt macro to integrate with headless mode. In headless mode without --version, uses the auto-detected version directly without confirmation.
Add --fetch-submodules flag to explicitly control whether git submodules should be fetched. Behavior: - With --fetch-submodules: Always fetch submodules - Without flag in headless mode: Skip submodules (default) - Without flag in interactive mode: Prompt user
Add --force/-f flag to control file overwrite behavior in headless mode. Behavior: - With --force: Silently overwrite existing files - Without --force in headless mode: Error with helpful message - In interactive mode: Prompt user (--force has no effect) This provides safe defaults while allowing automation when needed.
Replace large pattern matching blocks with centralized methods in BuildType: - Add cli_flag() to get flag name for each build type - Add from_cli_flag() to parse flag string into BuildType - Reduces ~60 lines of repetitive matching to ~15 lines - Improves maintainability for adding new build types - Error messages now automatically filter unavailable options
dhnaranjo
force-pushed
the
headless-cli
branch
from
October 13, 2025 05:41
adc6bc4 to
d38f30f
Compare
Member
|
Thank you for working on this, and also being honest with the LLM usage. I have a few design differences I want to make, which will involve moving around a lot of code, so I figured it will probably be easier for me to create a new pull request rather than going through every single detail with reviews. I will open a new pull request soon in favor of this one explaining those details and why I made those decisions. |
Merged
Author
|
For sure, no stress. Glad it’s a useful jump off point. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add headless mode to nix-init, enabling fully non-interactive package
initialization through CLI flags.
--headlessrequires--url, all other flags use the default value logic from the interactive flow.I'mma be real with you, I am not a Rust guy and I did have heavy LLM involvement in this thing, but I did sit here and write it, no vibe nonsense. I stand by it, but it might not be super idiomatic Rust.
fixes #648
• --headless - Enable non-interactive mode (requires --url)
• --rev - Specify git revision, tag, or commit hash
• --version-name - Specify package version
• --pname - Specify package name
• --build - Specify build type (go-mod, python-app, python-pkg, rust-pkg, drv)
• --fetch-submodules - Control submodule fetching (defaults to false in headless mode)
• --force - Allow overwriting existing output files in headless mode