Skip to content

Commit

Permalink
stylix: remove coercing of fonts
Browse files Browse the repository at this point in the history
This should hopefilly fix the infinite recursion errors in
danth#201 (comment)
  • Loading branch information
jalil-salame committed May 5, 2024
1 parent 26fd862 commit 08d5c57
Showing 1 changed file with 1 addition and 38 deletions.
39 changes: 1 addition & 38 deletions stylix/fonts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,7 @@ let
};
};

# A best hope mix of
#
# - lib.types.listOf
# - lib.types.nonEmptyListOf
# - lib.types.coercedTo
#
# My understanding is shallow and my hopes are high.
coercedToNonEmptyListOf = elemType: types.mkOptionType ({
name = "coercedToNonEmptyList of ${types.optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType}";
descriptionClass = "composite";
check = x: if builtins.isList x then x != [ ] else elemType.check x;
merge = loc: defs:
let coerceVal = val: if builtins.isList val then val else [ val ];
in
builtins.map (x: x.value) (builtins.filter (x: x ? value)
(builtins.concatLists
(lists.imap1
(n: def:
lists.imap1
(m: def':
(mergeDefinitions
(loc ++ [ "[definition ${toString n}-entry ${toString m}]" ])
elemType
[{ inherit (def) file; value = def'; }]
).optionalValue
)
def.value
)
(builtins.map (def: def // { value = coerceVal def.value; }) defs))));
emptyValue = { }; # unset
getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "*" ]);
getSubModules = elemType.getSubModules;
substSubModules = m: coercedToNonEmptyListOf (elemType.substSubModules m);
functor = (defaultFunctor name) // { wrapped = elemType; };
nestedTypes.elemType = elemType;
});

fontList = coercedToNonEmptyListOf fontType;
fontList = types.nonEmptyListOf fontType;
in
{
options.stylix.fonts = {
Expand Down

0 comments on commit 08d5c57

Please sign in to comment.