Skip to content

Commit

Permalink
fixup! feat(fonts): Add support for fallback fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
jalil-salame committed Dec 23, 2023
1 parent 78285f2 commit ed9da77
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
2 changes: 1 addition & 1 deletion modules/i3/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let
fonts = let
inherit (config.stylix) fonts;
in {
names = builtins.map ({ name, ... }: name) fonts.sansSerif;
names = lib.catAttrs "name" fonts.sansSerif;
size = fonts.sizes.desktop * 1.0;
};

Expand Down
2 changes: 1 addition & 1 deletion modules/sway/hm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
inherit (config.stylix) fonts;
inherit (fonts) sizes;
in {
names = builtins.map ({ name, ... }: name) fonts.sansSerif;
names = lib.catAttrs "name" fonts.sansSerif;
size = sizes.desktop + 0.0;
};

Expand Down
11 changes: 5 additions & 6 deletions stylix/darwin/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{ config, ... }:
{ config, lib, ... }:

let
cfg = config.stylix.fonts;
inherit (../helper.nix) fontPackages;
in {
imports = [ ../fonts.nix ];
config.fonts = {
fontDir.enable = true;

fonts = (fontPackages cfg.monospace)
++ (fontPackages cfg.serif)
++ (fontPackages cfg.sansSerif)
++ (fontPackages cfg.emoji);
fonts = (lib.catAttrs "package" cfg.monospace)
++ (lib.catAttrs "package" cfg.serif)
++ (lib.catAttrs "package" cfg.sansSerif)
++ (lib.catAttrs "package" cfg.emoji);
};
}
7 changes: 0 additions & 7 deletions stylix/helper.nix

This file was deleted.

11 changes: 5 additions & 6 deletions stylix/hm/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{ config, ... }:
{ config, lib, ... }:

let
cfg = config.stylix.fonts;
inherit (../helper.nix) fontPackages;
in {
imports = [ ../fonts.nix ];
config = {
fonts.fontconfig.enable = true;
home.packages = (fontPackages cfg.monospace)
++ (fontPackages cfg.serif)
++ (fontPackages cfg.sansSerif)
++ (fontPackages cfg.emoji);
home.packages = (lib.catAttrs "package" cfg.monospace)
++ (lib.catAttrs "package" cfg.serif)
++ (lib.catAttrs "package" cfg.sansSerif)
++ (lib.catAttrs "package" cfg.emoji);
};
}
19 changes: 9 additions & 10 deletions stylix/nixos/fonts.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{ config, ... }:
{ config, lib, ... }:

let
cfg = config.stylix.fonts;
inherit (../helper.nix) fontPackages fontNames;
in {
imports = [ ../fonts.nix ];
config.fonts = {
packages = (fontPackages cfg.monospace)
++ (fontPackages cfg.serif)
++ (fontPackages cfg.sansSerif)
++ (fontPackages cfg.emoji);
packages = (lib.catAttrs "package" cfg.monospace)
++ (lib.catAttrs "package" cfg.serif)
++ (lib.catAttrs "package" cfg.sansSerif)
++ (lib.catAttrs "package" cfg.emoji);

fontconfig.defaultFonts = {
monospace = fontNames cfg.monospace;
serif = fontNames cfg.serif;
sansSerif = fontNames cfg.sansSerif;
emoji = fontNames cfg.emoji;
monospace = lib.catAttrs "name" cfg.monospace;
serif = lib.catAttrs "name" cfg.serif;
sansSerif = lib.catAttrs "name" cfg.sansSerif;
emoji = lib.catAttrs "name" cfg.emoji;
};
};
}

0 comments on commit ed9da77

Please sign in to comment.