mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
flake-parts/setups/nixos: add specialArgs through declarative setups
This commit is contained in:
parent
e983561f99
commit
9292a75ffa
@ -39,5 +39,20 @@
|
|||||||
allowUnfree = true;
|
allowUnfree = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sharedSpecialArgs = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf anything;
|
||||||
|
description = ''
|
||||||
|
Shared set of arguments to be assigned as part of `_module.specialArgs`
|
||||||
|
of each of the declarative setups.
|
||||||
|
'';
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
location = "Inside of your walls";
|
||||||
|
utilsLib = import ./lib/utils.nix;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -170,6 +170,7 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
config.nixpkgs.config = cfg.sharedNixpkgsConfig;
|
config.nixpkgs.config = cfg.sharedNixpkgsConfig;
|
||||||
|
config.specialArgs = cfg.sharedSpecialArgs;
|
||||||
|
|
||||||
config.modules = [
|
config.modules = [
|
||||||
# Bring in the required modules.
|
# Bring in the required modules.
|
||||||
@ -209,6 +210,13 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sharedSpecialArgs = options.setups.sharedSpecialArgs // {
|
||||||
|
description = ''
|
||||||
|
Shared set of module arguments as part of `_module.specialArgs` of the
|
||||||
|
configuration.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
sharedModules = lib.mkOption {
|
sharedModules = lib.mkOption {
|
||||||
type = with lib.types; listOf deferredModule;
|
type = with lib.types; listOf deferredModule;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
@ -222,6 +230,7 @@ in
|
|||||||
(import ./shared/nix-conf.nix { inherit inputs; })
|
(import ./shared/nix-conf.nix { inherit inputs; })
|
||||||
(import ./shared/config-options.nix { inherit (config) systems; })
|
(import ./shared/config-options.nix { inherit (config) systems; })
|
||||||
./shared/nixpkgs-options.nix
|
./shared/nixpkgs-options.nix
|
||||||
|
./shared/special-args-options.nix
|
||||||
configType
|
configType
|
||||||
]);
|
]);
|
||||||
default = { };
|
default = { };
|
||||||
@ -318,6 +327,7 @@ in
|
|||||||
in
|
in
|
||||||
lib.nameValuePair system (mkHost {
|
lib.nameValuePair system (mkHost {
|
||||||
inherit pkgs system;
|
inherit pkgs system;
|
||||||
|
inherit (metadata) specialArgs;
|
||||||
extraModules = cfg.sharedModules ++ metadata.modules;
|
extraModules = cfg.sharedModules ++ metadata.modules;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
14
modules/flake-parts/setups/shared/special-args-options.nix
Normal file
14
modules/flake-parts/setups/shared/special-args-options.nix
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.specialArgs = lib.mkOption {
|
||||||
|
type = with lib.types; attrsOf anything;
|
||||||
|
default = { };
|
||||||
|
example = lib.literalExpression ''
|
||||||
|
{
|
||||||
|
location = "Your mom's home";
|
||||||
|
utilsLib = import ./lib/utils.nix;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user