cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.04k stars 303 forks source link

scaffolding feature as a sub-command (`devenv scaffold` as a counterpart to `devenv init`) #1354

Open stuzenz opened 1 month ago

stuzenz commented 1 month ago

Maybe not a high priority, thought it would be worth noting another possible UX/DX opportunity.

As much as the current workflow and API to declare environments using devenv is great, I feel that a nice counterpart for devenv init could be a devenv scaffold command where you might even have some auto-suggest/completion working with it

The end result would be something like what we have in the examples folder of the devenv project where the devenv.yaml and devenv.nix config is declared based on the scaffold request.

It would only be for a starting point to further work with - but it could be a nice opinionated way to provide a starting position for the devenv.nix that goes beyond the empty slate start currently provided by devenv init.

Thinking out loud here, the naming conventions for the scaffolding options could closely align with the existing schema. However, if an auto-suggest feature were integrated into the terminal, it could significantly enhance usability.

For example, the command might look like this: devenv scaffold languages.python venv pkgs.pip languages.rust cargo services.postgres

Or even continuing with the same devenv init command, but parse it for additional options. devenv init languages.python venv pkgs.pip languages.rust cargo services.postgres

I think the scaffolding idea aligns with the thinking behind devenv - that it would reduce some friction from a DX perspective in setting up environments.

Bullish-Design commented 1 month ago

Related to this question - is there a way to call a different template on the devenv init command? Or at the very least a way to modify the standard init file template?

domenkozar commented 1 month ago

@Bullish-Design can you say more what you'd like, to provide your own template or just have a better default collection?

Bullish-Design commented 1 month ago

@domenkozar - I'm looking for the ability to provide my own template - ideally different templates via the CLI init command. I tend to have similar project setups, so it would be handy to be able to call a standard "Python-Data" template for one project, then a "Rust-Backend" for the next.

stuzenz commented 1 month ago

A public template repository accessible from the CLI could work well.