From d80efcfbc61a50bb2e1dfbd955b55a9a08d2e757 Mon Sep 17 00:00:00 2001 From: Ratson Date: Sat, 2 Nov 2024 00:15:19 +0800 Subject: [PATCH] Ensure module args is set for modules --- builtinModules/homeModules.nix | 8 ++++++++ builtinModules/nixosModules.nix | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/builtinModules/homeModules.nix b/builtinModules/homeModules.nix index c382e85..ea95031 100644 --- a/builtinModules/homeModules.nix +++ b/builtinModules/homeModules.nix @@ -17,6 +17,14 @@ in homeModules = mkOption { type = optCallWith moduleArgs (lazyAttrsOf module); + apply = modules: builtins.mapAttrs + (_: module: { + imports = [ + { _module.args = builtins.mapAttrs (_: v: lib.mkDefault v) config._module.args; } + module + ]; + }) + modules; default = { }; }; }; diff --git a/builtinModules/nixosModules.nix b/builtinModules/nixosModules.nix index 15f1078..34887b1 100644 --- a/builtinModules/nixosModules.nix +++ b/builtinModules/nixosModules.nix @@ -17,6 +17,14 @@ in nixosModules = mkOption { type = optCallWith moduleArgs (lazyAttrsOf module); + apply = modules: builtins.mapAttrs + (_: module: { + imports = [ + { _module.args = builtins.mapAttrs (_: v: lib.mkDefault v) config._module.args; } + module + ]; + }) + modules; default = { }; }; };