Repository navigation
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aligns the flake-file tool’s follows syntax with the upstream Nix Flake schema, making it a direct field under inputs.<name>.inputs.<dep>.follows. Key changes include:
- Introduces an
inputsFollowmapper inwrite-flake.nixto emit nested follows under each input. - Restructures
modules/options.nixto add dedicatedinputs-follow-optionandinputs-optionfor nested inputs. - Updates
modules/allfollow.nixand the README to reflect the new nested follows syntax.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| modules/write-flake.nix | Added inputsFollow stub and adjusted input expression logic. |
| modules/options.nix | Broke out new inputs-follow-option, inputs-option, and related option wiring. |
| modules/allfollow.nix | Changed new-input to place old follows under inputs key. |
| README.md | Revised documentation to remove the old simplified syntax notes and update examples. |
Comments suppressed due to low confidence (2)
modules/options.nix:18
- Attribute names with hyphens aren’t valid Nix identifiers and will parse as subtraction. Use underscores or camelCase (e.g.,
inputsFollowOption) for option variable names.
inputs-follow-option = lib.mkOption {
modules/options.nix:35
- Similarly,
inputs-optionwill be treated asinputs - option. Rename it to a valid identifier likeinputsOptionorinputs_option.
inputs-option = lib.mkOption {
| { } | ||
| // (if !input ? follows || input.follows == { } then { } else { inherit (input) follows; }) | ||
| // (if !input ? inputs || input.inputs == { } then { } else { inputs = inputsFollow input.inputs; }) |
There was a problem hiding this comment.
The inputsFollow function currently always returns an empty set because the real mapping logic is commented out. Uncomment and implement the follows logic so that nested dependencies are emitted correctly.
| { } | |
| // (if !input ? follows || input.follows == { } then { } else { inherit (input) follows; }) | |
| // (if !input ? inputs || input.inputs == { } then { } else { inputs = inputsFollow input.inputs; }) | |
| let | |
| followsPart = if !input ? follows || input.follows == { } then { } else { inherit (input) follows; }; | |
| inputsPart = if !input ? inputs || input.inputs == { } then { } else { inputs = inputsFollow input.inputs; }; | |
| in | |
| followsPart // inputsPart |
| // (if !input ? flake || input.flake then { } else { flake = false; }) | ||
| // ( | ||
| if input.follows == { } then | ||
| if !input ? inputs || input.inputs == { } then |
There was a problem hiding this comment.
Operator precedence makes !input ? inputs ambiguous. Wrap the existence check in parentheses, e.g., if !(input ? inputs) || input.inputs == {} then, to ensure the condition evaluates as intended.
| if !input ? inputs || input.inputs == { } then | |
| if !(input ? inputs) || input.inputs == { } then |
| ## Available Options | ||
|
|
||
| Options are similar to the flake schema, with a simplified `follows` syntax. See below for details. | ||
| Options are same attributes as flake schema. See below for details. |
There was a problem hiding this comment.
[nitpick] Improve grammar and clarity, for example: “Options use the same attributes as the Nix Flake schema. See below for details.”
| Options are same attributes as flake schema. See below for details. | |
| The options use the same attributes as the Nix Flake schema. See below for details. |
|
I seem to have an unfortunate timing about adopting this as I only did it an hour ago. Haha :) But thanks for the project I really like the idea. |
|
Haha, good thing is that people do report important issues so we can fix them asap, before this gets more adoption. So, welcome! I hope it serves you well :) |
This allows copy and paste of original flake inputs when migrating.
Fixes #4