lib.types.defaultTypeMerge: Fix for functors with no wrapped attr (#476219)
This commit is contained in:
@@ -734,6 +734,8 @@ checkConfigOutput 'ok' config.freeformItems.foo.bar ./adhoc-freeformType-survive
|
||||
# Test that specifying both functor.wrapped and functor.payload isn't allowed
|
||||
checkConfigError 'Type foo defines both `functor.payload` and `functor.wrapped` at the same time, which is not supported.' config.result ./default-type-merge-both.nix
|
||||
|
||||
# Test that not including functor.wrapped is allowed
|
||||
checkConfigOutput 'ok' config.result ./default-type-merge-payload.nix
|
||||
|
||||
# Anonymous submodules don't get nixed by import resolution/deduplication
|
||||
# because of an `extendModules` bug, issue 168767.
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{ lib, options, ... }:
|
||||
let
|
||||
fooOf =
|
||||
elemType:
|
||||
lib.mkOptionType {
|
||||
name = "foo";
|
||||
functor = {
|
||||
name = "foo";
|
||||
type = payload: fooOf payload.elemType;
|
||||
binOp = a: _b: a;
|
||||
payload.elemType = elemType;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
{
|
||||
options.foo = lib.mkOption {
|
||||
type = fooOf lib.types.int;
|
||||
};
|
||||
}
|
||||
{
|
||||
options.foo = lib.mkOption {
|
||||
type = fooOf lib.types.int;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
options.result = lib.mkOption {
|
||||
default = builtins.seq options.foo "ok";
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user