Skip to content
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

Set key for modules and nixosModules #251

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion extras/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ let
then module: module
else
module:
# TODO: set key?
{
_class = class;
_file = "${toString moduleLocation}#modules.${escapeNixIdentifier class}.${escapeNixIdentifier moduleName}";
key = "${toString moduleLocation}#modules.${escapeNixIdentifier class}.${escapeNixIdentifier moduleName}";
imports = [ module ];
};
in
Expand Down
11 changes: 10 additions & 1 deletion modules/nixosModules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ in
nixosModules = mkOption {
type = types.lazyAttrsOf types.deferredModule;
default = { };
apply = mapAttrs (k: v: { _file = "${toString moduleLocation}#nixosModules.${k}"; imports = [ v ]; });
apply = mapAttrs (k: v: {
_file = "${toString moduleLocation}#nixosModules.${k}";
# Note: this neglects to represent potential differences due to input
# overrides or flake-parts extendModules. However, the cost for this
# is too high or plain infeasible respectively. We choose to implement
# deduplication and disabledModules regardless, because not doing
# so poses a more direct problem.
key = "${toString moduleLocation}#nixosModules.${k}";
Atry marked this conversation as resolved.
Show resolved Hide resolved
imports = [ v ];
});
description = ''
NixOS modules.

Expand Down