1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00

Merge pull request #243 from hercules-ci/partition

flakeModules.partitions: Improve and fix docs
This commit is contained in:
Robert Hensing 2024-08-30 13:06:22 +02:00 committed by GitHub
commit 4f37dc19b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 2 deletions

View file

@ -15,7 +15,12 @@ let
default = { };
description = ''
Location of a flake whose inputs to add to the inputs module argument in the partition.
Note that flake `follows` are resolved without any awareness of inputs that are not in the flake.
As a consequence, a `follows` entry in the flake inputs can not refer to inputs that are not in that specific flake.
Implementation note: if the type of `extraInputsFlake` is a path, it is loaded with an expression-based reimplementation of `builtins.getFlake`, as `getFlake` is incapable of loading paths in pure mode as of writing.
'';
example = lib.literalExpression "./dev";
};
extraInputs = mkOption {
type = types.lazyAttrsOf types.raw;
@ -51,8 +56,16 @@ let
description = ''
A re-evaluation of the flake-parts top level modules.
You may define config definitions, imports, etc here, and it can be read like any other submodule.
You may define config definitions, `imports`, etc here, and it can be read like any other submodule.
'';
example = lib.literalExpression ''
{
imports = [
./dev/flake-module.nix
];
}
'';
visible = "shallow";
};
};
config = {
@ -95,6 +108,11 @@ in
See the `partitions` options to understand the purpose.
'';
example = {
"devShells" = "dev";
"checks" = "dev";
"herculesCI" = "dev";
};
};
partitions = mkOption {
type = types.attrsOf (types.submodule partitionModule);
@ -116,6 +134,14 @@ in
is cheap, it can only happen after fetching the input, which is not
as cheap.
'';
example = lib.literalExpression ''
{
dev = {
extraInputsFlake = ./dev;
module = ./dev/flake-module.nix;
};
}
'';
};
};
config = {

View file

@ -58,7 +58,6 @@
partitionedAttrs.devShells = "dev";
partitionedAttrs.herculesCI = "dev";
partitions.dev.extraInputsFlake = ./dev;
partitions.dev.extraInputs.flake-parts = inputs.self;
partitions.dev.module = {
imports = [ ./dev/flake-module.nix ];
};