Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions extras/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ in
apply = mapAttrs (k: mapAttrs (addInfo k));
};
};
config = {
# Copy over to old nixosModules and hmModules attributes
flake = {
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.

I'm a little wary of conditional attributes in the flake option, because the condition will have to be evaluated before self and self.outPath become accessible, producing an infinite recursion otherwise. (Fixing this for self.outPath needs a more or less breaking change in flakes / call-flake.nix)
In most cases this would be fine, but in the few where it's not, it produces an almost incomprehensible error.

With that in mind, it'd be safer to make this a module that users import separately.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Instead of a separate module that has to be imported, would an option that disables the behavior an okay compromise?

nixosModules = lib.optional (lib.hasAttr "nixos" lib.flake.modules) lib.flake.modules.nixos;
hmModules = lib.optional (lib.hasAttr "homeManager" lib.flake.modules) lib.flake.modules.homeManager;
};
};
}