Skip to content

Commit

Permalink
fix(fonts): Coerce old fonts to fontLists
Browse files Browse the repository at this point in the history
This allows us to have a backwards compatible way to get fallback fonts.
  • Loading branch information
jalil-salame committed Feb 8, 2024
1 parent 211f6b6 commit 8942715
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stylix/fonts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ let
};
};

fontList = types.coercedTo fontType (f: [ f ]) (types.nonEmptyListOf fontType);
in {
options.stylix.fonts = {
serif = mkOption {
description = mdDoc "Serif font.";
type = types.nonEmptyListOf fontType;
type = fontList;
default = fromOs [ "fonts" "serif" ] [{
package = pkgs.dejavu_fonts;
name = "DejaVu Serif";
Expand All @@ -34,7 +35,7 @@ in {

sansSerif = mkOption {
description = mdDoc "Sans-serif font.";
type = types.nonEmptyListOf fontType;
type = fontList;
default = fromOs [ "fonts" "sansSerif" ] [{
package = pkgs.dejavu_fonts;
name = "DejaVu Sans";
Expand All @@ -43,7 +44,7 @@ in {

monospace = mkOption {
description = mdDoc "Monospace font.";
type = types.nonEmptyListOf fontType;
type = fontList;
default = fromOs [ "fonts" "monospace" ] [{
package = pkgs.dejavu_fonts;
name = "DejaVu Sans Mono";
Expand All @@ -52,7 +53,7 @@ in {

emoji = mkOption {
description = mdDoc "Emoji font.";
type = types.nonEmptyListOf fontType;
type = fontList;
default = fromOs [ "fonts" "emoji" ] [{
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
Expand Down

0 comments on commit 8942715

Please sign in to comment.