Skip to content

feat: support generating flake.nix via --flake#834

Open
ArisoN-ext wants to merge 1 commit into
nix-community:mainfrom
ArisoN-ext:flake-generate
Open

feat: support generating flake.nix via --flake#834
ArisoN-ext wants to merge 1 commit into
nix-community:mainfrom
ArisoN-ext:flake-generate

Conversation

@ArisoN-ext

Copy link
Copy Markdown
  • Add --flake CLI argument and flake configuration file option
  • Generate a minimalistic flake.nix template in the output directory
  • Format the generated file automatically using the configured formatter

- Add `--flake` CLI argument and `flake` configuration file option
- Generate a minimalistic `flake.nix` template in the output directory
- Format the generated file automatically using the configured formatter

@figsoda figsoda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is too opinionated imo, there isn't one convention to make a flake

nix-init is only supplying the description here, you can probably just run cp or something like that in addition to nix-init

@ArisoN-ext

ArisoN-ext commented Jul 20, 2026

Copy link
Copy Markdown
Author

this is too opinionated imo, there isn't one convention to make a flake

nix-init is only supplying the description here, you can probably just run cp or something like that in addition to nix-init

The flake is primarily here for convenience. Using nix-init to run programs through a flake is much more convenient. And since flake code style is somewhat subjective — which I agree with. I've kept this one as minimalistic as possible

@s0me1newithhand7s

Copy link
Copy Markdown

this is too opinionated imo, there isn't one convention to make a flake

there is a thin balance between heavy flake-part / blueprint usage and simple basic flake with 1 input and handful of outputs, which, imo this PR handles; we are getting a playground to expand but also ready-to-use, not a literal blueprint, neither a blank nix flake init output. hence... why not?

@figsoda

figsoda commented Jul 25, 2026

Copy link
Copy Markdown
Member

And since flake code style is somewhat subjective — which I agree with. I've kept this one as minimalistic as possible

choosing to be minimalistic here is itself subjective, and this is one of the decisions that i don't want nix-init to make

there is a thin balance between heavy flake-part / blueprint usage and simple basic flake with 1 input and handful of outputs, which, imo this PR handles

i think finding a balance is being opinionated, what is the right balance is up to personal preference

even if we agree on being minimalistic / not using stuff like flake-parts, there are still a lot of small decisions to make, nixos-unstable vs nixpkgs-unstable, whether to include a description, whether the package should be under default or the package name, and even smaller formatting preferences: ?ref= vs /, let inherit vs qualifying, that aren't covered by the formatter

nix-init is by no means completely opinionated, i try my best to follow the consensus on things, but there are some things (e.g. where __structuredAttrs should be,) that simply don't have a consensus, and i have to make a choice, but they are essential features that nix-init is made to support, whereas the --flake option can mostly be replaced with a cp command, and it takes very little effort to create a nix-init-flake command that just runs nix-init along with the cp command, where anyone can personalize the flake to their own preferences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants