Skip to content

Commit

Permalink
home-manager/theme: add symbols font
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Oct 16, 2023
1 parent 7eed75b commit 1bdee08
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
19 changes: 14 additions & 5 deletions home-manager/cli/nnn.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@

let
inherit (flake) inputs;
cfg = config.home-manager.cli.nnn;
in
{
options.home-manager.cli.nnn.enable = lib.mkEnableOption "nnn config" // {
default = config.home-manager.cli.enable;
options.home-manager.cli.nnn = {
enable = lib.mkEnableOption "nnn config" // {
default = config.home-manager.cli.enable;
};
# Do not forget to set 'Hack Nerd Mono Font' as the terminal font
enableIcons = lib.mkEnableOption "icons" // {
default = config.home-manager.desktop.enable || config.home-manager.darwin.enable;
};
};

config = lib.mkIf config.home-manager.cli.nnn.enable {
home.packages = [ (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) ];
config = lib.mkIf cfg.enable {
home.packages = lib.optionals cfg.enableIcons [
config.home-manager.desktop.theme.fonts.symbols.package
];

programs.nnn = {
enable = true;
package = pkgs.nnn.override { withNerdIcons = true; };
package = pkgs.nnn.override { withNerdIcons = cfg.enableIcons; };
bookmarks = {
d = "~/Documents";
D = "~/Downloads";
Expand Down
3 changes: 1 addition & 2 deletions home-manager/desktop/kitty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
enable = true;
keybindings = { "ctrl+shift+0" = "change_font_size all 0"; };
font = {
package = pkgs.nerdfonts.override { fonts = [ "Hack" ]; };
name = "Hack Nerd Font";
inherit (config.home-manager.desktop.theme.fonts.symbols) package name;
};
settings = with config.home-manager.desktop.theme.colors; {
# Font
Expand Down
12 changes: 9 additions & 3 deletions home-manager/desktop/sway/waybar.nix
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,18 @@ in
};
};
};
# TODO: get fonts from config.home-manager.desktop.theme.fonts
style = with config.home-manager.desktop.theme.colors; ''
style = with config.home-manager.desktop.theme.colors; with config.home-manager.desktop.theme.fonts; let
concatFonts = fonts: lib.pipe fonts [
lib.flatten
(map (s: ''"${s}"''))
(lib.concatStringsSep ", ")
];
in
''
* {
border: none;
border-radius: 0;
font-family: Roboto, "Font Awesome 6 Free Solid", "Symbols Nerd Font";
font-family: ${concatFonts [ gui.name icons.name "Symbols Nerd Font" ]};
}
window#waybar {
background: ${base00};
Expand Down
14 changes: 12 additions & 2 deletions home-manager/desktop/theme/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ in
fonts = {
gui = lib.mkOption {
type = lib.types.nullOr themeType;
description = "GUI main font";
description = "GUI font";
default = {
package = pkgs.roboto;
name = "Roboto";
Expand All @@ -32,7 +32,7 @@ in

icons = lib.mkOption {
type = lib.types.nullOr themeType;
description = "Icons main font";
description = "Icons font";
default = {
package = pkgs.font-awesome_6;
name = [
Expand All @@ -42,6 +42,15 @@ in
};
};

symbols = lib.mkOption {
type = lib.types.nullOr themeType;
description = "Symbols font";
default = {
package = pkgs.nerdfonts.override { fonts = [ "Hack" ]; };
name = "Hack Nerd Font";
};
};

dpi = lib.mkOption {
type = lib.types.int;
description = "Font dpi";
Expand Down Expand Up @@ -78,6 +87,7 @@ in
dejavu_fonts
fonts.gui.package
fonts.icons.package
fonts.symbols.package
gnome.gnome-themes-extra
hack-font
hicolor-icon-theme
Expand Down
2 changes: 1 addition & 1 deletion home-manager/editor/neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ in
ripgrep
]
++ lib.optionals cfg.enableIcons [
(nerdfonts.override { fonts = [ "Hack" ]; })
config.home-manager.desktop.theme.fonts.symbols.package
];

programs.neovim = {
Expand Down

0 comments on commit 1bdee08

Please sign in to comment.