flake-parts/setups: fix specialArgs inheritance from global setup module

This commit is contained in:
Gabriel Arazas 2025-02-15 19:40:46 +08:00
parent f693f24903
commit e1be6b4d04
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
4 changed files with 20 additions and 10 deletions

View File

@ -349,6 +349,8 @@ in {
config = lib.mkMerge [
{
setups.home-manager.sharedNixpkgsConfig = config.setups.sharedNixpkgsConfig;
setups.home-manager.sharedSpecialArgs = config.setups.sharedSpecialArgs;
}
(lib.mkIf (cfg.configs != { }) {

View File

@ -269,6 +269,8 @@ in {
config = lib.mkMerge [
{
setups.nixos.sharedNixpkgsConfig = config.setups.sharedNixpkgsConfig;
setups.nixos.sharedSpecialArgs = config.setups.sharedSpecialArgs;
}
(lib.mkIf (cfg.configs != { }) {

View File

@ -225,6 +225,8 @@ in {
config = lib.mkMerge [
{
setups.nixvim.sharedNixpkgsConfig = config.setups.sharedNixpkgsConfig;
setups.nixvim.sharedSpecialArgs = config.setups.sharedSpecialArgs;
}
(lib.mkIf (cfg.configs != { }) {

View File

@ -63,17 +63,9 @@ let
};
wrapperManagerConfigModule = { name, config, lib, ... }: {
options.wrapper-manager.src = lib.mkOption {
type = lib.types.path;
default = ../../../subprojects/wrapper-manager-fds;
description = ''
The path containing wrapper-manager-fds source code to be used to
properly initialize and create the wrapper-manager environment.
'';
};
config = {
nixpkgs.config = cfg.sharedNixpkgsConfig;
specialArgs = cfg.sharedSpecialArgs;
modules = [
"${partsConfig.setups.configDir}/wrapper-manager/${config.configName}"
@ -94,6 +86,7 @@ in {
attrsOf (submodule [
(import ./shared/config-options.nix { inherit (config) systems; })
./shared/nixpkgs-options.nix
./shared/special-args-options.nix
wrapperManagerConfigModule
]);
default = { };
@ -111,6 +104,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 = [ ];
@ -160,6 +160,9 @@ in {
{
setups.wrapper-manager.sharedNixpkgsConfig =
config.setups.sharedNixpkgsConfig;
setups.wrapper-manager.sharedSpecialArgs =
config.setups.sharedSpecialArgs;
}
(lib.mkIf (cfg.configs != { }) {
@ -177,11 +180,12 @@ in {
};
in mkWrapperManagerPackage {
inherit pkgs;
inherit (metadata) specialArgs;
inherit (metadata.wrapper-manager) src;
modules = cfg.sharedModules ++ cfg.standaloneModules
++ metadata.modules;
}) validWrapperManagerConfigs;
};
});
})
];
}