From f46c31233225751eae2522247e6e7188c7a2f42b Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Thu, 12 Sep 2024 23:23:32 +0000 Subject: [PATCH] Set `key` for `modules` and `nixosModules` --- extras/modules.nix | 2 +- modules/nixosModules.nix | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/modules.nix b/extras/modules.nix index 98e9a96..3626a15 100644 --- a/extras/modules.nix +++ b/extras/modules.nix @@ -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 diff --git a/modules/nixosModules.nix b/modules/nixosModules.nix index 89cb301..1b1821d 100644 --- a/modules/nixosModules.nix +++ b/modules/nixosModules.nix @@ -15,7 +15,11 @@ 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}"; + key = "${toString moduleLocation}#nixosModules.${k}"; + imports = [ v ]; + }); description = '' NixOS modules.