Open
Conversation
Implemented with ImprovementsI've adopted this feature with enhanced error handling for better robustness. ImplementationThe template description auto-extraction now: ✅ Automatically extracts description from Key Differences from Original PRThe implementation includes additional safety checks: create-template-metadata = template: let
flake-file = template + "/flake.nix";
has-flake = builtins.pathExists flake-file;
flake-attrs = if has-flake then import flake-file else {};
description = flake-attrs.description or null;
in
{ name = ...; path = template; }
// (if description != null then {inherit description;} else {});This ensures templates without UsageTemplates can now simply define their description in their own # templates/my-template/flake.nix
{
description = "My awesome template!";
# ... rest of template flake
}No manual configuration needed in the parent flake! Commit: anntnzrb/snowfall-lib@f00967f |
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.
Currently you need to manually add a description for templates as per the documentation
However, it seems easier and more sane to automatically extract the description from
./templates/my-template/flake.nix's description field. This is what this PR does, meaning that you no longer need to add the above description manually.