-
-
Notifications
You must be signed in to change notification settings - Fork 5
basic batteries included #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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 refactors the module structure by moving configuration from nix/ to a new modules/ directory and reorganizing the aspect system. The refactoring improves modularity and introduces a clearer separation between different concerns.
- Simplified
nix/flakeModule.nixto useimport-treefor automatic module importing from../modules - Reorganized aspect-related code into separate modules under
modules/aspects/ - Added new configuration modules (
modules/config.nix,modules/options.nix,modules/scope.nix)
Reviewed Changes
Copilot reviewed 7 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| nix/template-packages.nix | New file providing package definitions for templates using flake-compat |
| nix/flakeModule.nix | Simplified to delegate module imports to import-tree |
| nix/aspects.nix | Removed (logic moved to modules/aspects/) |
| modules/scope.nix | New file setting up the den scope using flake-aspects |
| modules/options.nix | New file defining den.hosts and den.homes options |
| modules/config.nix | New file building OS and home configurations |
| modules/aspects/dependencies.nix | Refactored aspect dependency creation logic from nix/aspects.nix |
| modules/aspects/den-batteries/_import-tree.nix | New aspect provider for importing class-based directory structures |
| modules/aspects/defaults.nix | Extracted default aspect definitions from nix/aspects.nix |
| modules/_types.nix | New file containing type definitions for hosts and homes |
| flake.nix | Updated packages reference to use template-packages.nix |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 9 out of 13 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d05252b to
1137df2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 11 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 15 out of 20 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,14 @@ | |||
| # configures class-automatic module auto imports for hosts/users/homes. | |||
| # See _example/hosts/*/_${class}/*.nix | |||
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path reference should be _compat instead of _example to match the actual directory structure shown in the file.
| # See _example/hosts/*/_${class}/*.nix | |
| # See _compat/hosts/*/_${class}/*.nix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| value.imports = [ (hmModule user) ]; | ||
| }) hmUsers; | ||
|
|
||
| aspect.${class} = | ||
| { pkgs, ... }: | ||
| let | ||
| homeDir = if pkgs.stdenvNoCC.isDarwin then "/Users/${user.userName}" else "/home/${user.userName}"; | ||
| in | ||
| { | ||
| imports = [ inputs.${host.hm-input or "home-manager"}."${class}Modules".home-manager ]; | ||
| home-manager.users = lib.listToAttrs homes; | ||
| users.users.${user.userName} = { | ||
| name = lib.mkDefault user.userName; | ||
| home = lib.mkDefault homeDir; | ||
| }; |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable user is not in scope here. The function signature at line 30 takes { host } as parameter, not { host, user }. The user variable should be referenced from the hmUsers iteration context or passed as a parameter.
| value.imports = [ (hmModule user) ]; | |
| }) hmUsers; | |
| aspect.${class} = | |
| { pkgs, ... }: | |
| let | |
| homeDir = if pkgs.stdenvNoCC.isDarwin then "/Users/${user.userName}" else "/home/${user.userName}"; | |
| in | |
| { | |
| imports = [ inputs.${host.hm-input or "home-manager"}."${class}Modules".home-manager ]; | |
| home-manager.users = lib.listToAttrs homes; | |
| users.users.${user.userName} = { | |
| name = lib.mkDefault user.userName; | |
| home = lib.mkDefault homeDir; | |
| }; | |
| value = { | |
| imports = [ (hmModule user) ]; | |
| users = { | |
| users = { | |
| ${user.userName} = { | |
| name = lib.mkDefault user.userName; | |
| home = lib.mkDefault ( | |
| pkgs: if pkgs.stdenvNoCC.isDarwin then "/Users/${user.userName}" else "/home/${user.userName}" | |
| ); | |
| }; | |
| }; | |
| }; | |
| }; | |
| }) hmUsers; | |
| aspect.${class} = | |
| { pkgs, ... }: | |
| { | |
| imports = [ inputs.${host.hm-input or "home-manager"}."${class}Modules".home-manager ]; | |
| home-manager.users = lib.listToAttrs (map (user: { | |
| name = user.userName; | |
| value = { | |
| imports = [ (hmModule user) ]; | |
| }; | |
| }) hmUsers); | |
| users.users = lib.foldl' (acc: user: acc // (homes | |
| # get the value for this user and apply pkgs to home | |
| |> builtins.filter (h: h.name == user.userName) | |
| |> (hlist: if hlist == [] then {} else | |
| let h = hlist[0]; in | |
| lib.mapAttrs (k: v: if k == "users" then | |
| lib.mapAttrs (u: uconf: { | |
| name = uconf.name; | |
| home = uconf.home pkgs; | |
| }) v.users | |
| else v) h.value | |
| ) | |
| ) | |
| ) {} hmUsers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
| in | ||
| { | ||
| imports = [ hm ] ++ perUser; |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The perUser variable is a list created by map perUser (lib.attrValues host.users) on line 51, but it's being concatenated directly here. Since perUser is already a list of attribute sets, this should work, but the variable name users on line 51 would be clearer than reusing the function name perUser which is defined on line 52.
| imports = [ hm ] ++ perUser; | |
| imports = [ hm ] ++ users; |
| nix run .#write-flake --override-input den "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | ||
| nix flake update den |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --override-input flag is added on line 37, but line 38 immediately runs nix flake update den which may override the previous input override. Consider whether the flake update is necessary after the override, or if the order should be reversed.
| nix run .#write-flake --override-input den "github:$GITHUB_REPOSITORY/$GITHUB_SHA" | |
| nix flake update den | |
| nix flake update den | |
| nix run .#write-flake --override-input den "github:$GITHUB_REPOSITORY/$GITHUB_SHA" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { home }: | ||
| { class, ... }: | ||
| let | ||
| path = if class == "darwin" then "/Users" else "/home"; |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic determines the home directory path based on the class. Consider using the same approach as in modules/aspects/batteries/home-manager.nix line 51 which also implements this pattern, to ensure consistency. Additionally, the previous implementation checked if the system string 'hasSuffix "darwin"', which may be more robust than relying solely on the class name.
| { home }: | |
| { class, ... }: | |
| let | |
| path = if class == "darwin" then "/Users" else "/home"; | |
| { home, system }: | |
| { class, ... }: | |
| let | |
| path = if lib.hasSuffix system "darwin" then "/Users" else "/home"; |
f16b1cc to
feb91fa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| inputs, | ||
| den, | ||
| lib, | ||
| ... |
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module function parameters are missing lib, which is used on lines 93, 97, and 98. Add lib to the function parameters to avoid evaluation errors.
1e6a2c8 to
2aac283
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,14 @@ | |||
| # configures class-automatic module auto imports for hosts/users/homes. | |||
| # See _example/hosts/*/_${class}/*.nix | |||
Copilot
AI
Oct 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment references 'example/hosts/*/${class}/*.nix' but the actual paths used in the code are './_compat/hosts', './_compat/users', and './_compat/homes'. This should be updated to reference '_compat/' instead of '_example/' to match the actual implementation.
| # See _example/hosts/*/_${class}/*.nix | |
| # See _compat/hosts/*/_${class}/*.nix |
move defaults fixing hm fixing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 22 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
list of changes:
den.aspects.defaulttoden.defaultthis is to avoid poluting the
aspectsnamespace since we expect lots of user customaspects to be there.
allows people to import non-dendritic nix directories.
helps with migration path. and for auto-generated stuff like nixos-hardware.
Pending for other PR: