From 788880c1e6df5295410d5f32825ab9549115e532 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 22 Jan 2025 13:35:51 +0800 Subject: [PATCH] flake-parts/setups: add specialArgs option for home-manager and NixVim configs --- modules/flake-parts/setups/home-manager.nix | 9 +++++++++ modules/flake-parts/setups/nixvim.nix | 11 +++++++++++ 2 files changed, 20 insertions(+) diff --git a/modules/flake-parts/setups/home-manager.nix b/modules/flake-parts/setups/home-manager.nix index 9f447b1f..8812abeb 100644 --- a/modules/flake-parts/setups/home-manager.nix +++ b/modules/flake-parts/setups/home-manager.nix @@ -120,6 +120,7 @@ let ]; nixpkgs.config = cfg.sharedNixpkgsConfig; + specialArgs = cfg.sharedSpecialArgs; }; }; in @@ -132,6 +133,13 @@ in ''; }; + sharedSpecialArgs = options.setups.sharedSpecialArgs // { + description = '' + Shared set of module arguments as part of `_module.specialArgs` of the + configuration. + ''; + }; + sharedModules = lib.mkOption { type = with lib.types; listOf deferredModule; default = [ ]; @@ -165,6 +173,7 @@ in (import ./shared/nix-conf.nix { inherit inputs; }) (import ./shared/config-options.nix { inherit (config) systems; }) ./shared/nixpkgs-options.nix + ./shared/special-args-options.nix configType ]); default = { }; diff --git a/modules/flake-parts/setups/nixvim.nix b/modules/flake-parts/setups/nixvim.nix index 65fe638f..a705213b 100644 --- a/modules/flake-parts/setups/nixvim.nix +++ b/modules/flake-parts/setups/nixvim.nix @@ -108,6 +108,8 @@ let modules = [ "${partsConfig.setups.configDir}/nixvim/${config.configName}" ]; + + specialArgs = cfg.sharedSpecialArgs; }; }; @@ -169,6 +171,7 @@ in configs = lib.mkOption { type = with lib.types; attrsOf (submodule [ (import ./shared/config-options.nix { inherit (config) systems; }) + ./shared/special-args-options.nix configType ]); default = { }; @@ -186,6 +189,14 @@ in environments when NixVim-specific integrations has been enabled. ''; }; + + sharedSpecialArgs = options.setups.sharedSpecialArgs // { + description = '' + Shared set of module arguments as part of `_module.specialArgs` of the + configuration. + ''; + }; + standaloneConfigModules = modulesOption' "standalone configuration"; sharedNixpkgsConfig = options.setups.sharedNixpkgsConfig // {