Skip to content

Commit

Permalink
chore(lib): fix for a new version of nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
PerchunPak committed Dec 10, 2024
1 parent a817009 commit 5a149ed
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5a149ed

Please sign in to comment.