diff --git a/modules/lib/default.nix b/modules/lib/default.nix index ec446745..61d25f6b 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -133,8 +133,15 @@ in # a -> a -> a # see https://nlewo.github.io/nixos-manual-sphinx/development/option-types.xml.html # by default enums cannot be merged, but they keep their passed value in `functor.payload`. - # `functor.binOp` can merge those values - mergeEnums = a: b: lib.types.enum (a.functor.binOp a.functor.payload b.functor.payload); + # (or `functor.payload.values` on unstable) `functor.binOp` can merge those values + mergeEnums = + a: b: + let + result = a.functor.binOp a.functor.payload b.functor.payload; + # see https://github.com/NixOS/nixpkgs/commit/062945b725875167a24b11c4c1f2ba8e7623d3d6 + values = if builtins.typeOf result == "set" then result.values else result; + in + lib.types.enum values; # string # returns the current release version of nixos or home-manager. throws an evaluation error if neither are