lib/types: use payload instead of wrapper in dagOf

This is the more modern approach: https://github.com/NixOS/nixpkgs/pull/375084
The above PR does this for similar cases in nixpkgs.

This fixes a warning that shows up when using the lib in weird ways:

```
trace: evaluation warning: The deprecated `functor.wrapped` attribute is accessed, use `nestedTypes.elemType` instead.
```

The warning is thrown by the module system when merging types
(at least in some cases).
It shouldn't be exposed at all in the current codebase.
This commit is contained in:
alfarel 2025-09-27 00:21:46 +00:00
commit 88d1e1c902
No known key found for this signature in database

View file

@ -3,7 +3,6 @@
{lib}: let {lib}: let
inherit inherit
(lib) (lib)
defaultFunctor
nvim nvim
mkIf mkIf
mkOrder mkOrder
@ -62,7 +61,18 @@ in rec {
inherit (elemType) getSubModules; inherit (elemType) getSubModules;
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]); getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["<name>"]);
substSubModules = m: dagOf (elemType.substSubModules m); substSubModules = m: dagOf (elemType.substSubModules m);
functor = (defaultFunctor name) // {wrapped = elemType;}; # Based on the result of calling the nixpkgs types.nix elemTypeFunctor helper function.
functor = {
inherit name;
payload.elemType = elemType;
type = payload: types.${name} payload.elemType;
binOp = a: b: let
merged = a.elemType.typeMerge b.elemType.functor;
in
if merged == null
then null
else {elemType = merged;};
};
nestedTypes.elemType = elemType; nestedTypes.elemType = elemType;
}; };
} }