Skip to content

smaller flake files by collapsing single attrs#46

Merged
vic merged 1 commit into
mainfrom
smaller
Nov 16, 2025
Merged

smaller flake files by collapsing single attrs#46
vic merged 1 commit into
mainfrom
smaller

Conversation

@vic
Copy link
Copy Markdown
Member

@vic vic commented Nov 16, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 16, 2025 01:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR reduces the size of generated flake.nix files by collapsing single-attribute nested structures into dot notation (e.g., { flake-file = { url = "..."; }; } becomes flake-file.url = "...").

Key Changes:

  • Introduced a new nixAttr function that recursively collapses single-attribute nested structures
  • Modified nixCode to use nixAttr for attribute transformation before code generation
  • Regenerated all template flake.nix files using the new logic

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
modules/write-flake.nix Implements the core nixAttr function for collapsing nested single-attribute structures and integrates it into nixCode
templates/parts/flake.nix Regenerated with collapsed input declarations (5 inputs collapsed from nested to dot notation)
templates/dendritic/flake.nix Regenerated with collapsed input declarations (7 inputs collapsed, mixed with multi-attribute inputs)
templates/default/flake.nix Regenerated with collapsed input declarations (4 inputs collapsed from nested to dot notation)
dev/flake.nix Regenerated with collapsed input declarations (complex mix of collapsed and preserved multi-attribute structures)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread modules/write-flake.nix
@@ -26,14 +26,33 @@ let
addHeader
];

Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

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

The new nixAttr function lacks a comment explaining its purpose and behavior. Consider adding documentation similar to the comment on line 47 for nixCode.

For example:

# Recursively collapse single-attribute nested structures
# e.g., { foo = { bar = "baz"; }; } becomes { name = "foo.bar"; value = "baz"; }
nixAttr =
  name: value:
  ...
Suggested change
# Recursively collapse single-attribute nested structures
# e.g., { foo = { bar = "baz"; }; } becomes { name = "foo.bar"; value = "baz"; }

Copilot uses AI. Check for mistakes.
@vic vic merged commit 71cc6ec into main Nov 16, 2025
12 checks passed
@vic vic deleted the smaller branch November 16, 2025 01:18
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.

2 participants