diff --git a/users/guanranwang/home-manager/actual-modules/default.nix b/users/guanranwang/home-manager/actual-modules/default.nix new file mode 100644 index 0000000..af93534 --- /dev/null +++ b/users/guanranwang/home-manager/actual-modules/default.nix @@ -0,0 +1,5 @@ +{...}: { + imports = [ + ./terminal.nix + ]; +} diff --git a/users/guanranwang/home-manager/actual-modules/terminal.nix b/users/guanranwang/home-manager/actual-modules/terminal.nix new file mode 100644 index 0000000..b868eca --- /dev/null +++ b/users/guanranwang/home-manager/actual-modules/terminal.nix @@ -0,0 +1,84 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myFlake.home-manager.terminal; +in { + # 3 terminals, one module. + # -- The Orange Box (wtf) + + # FAQ (for future myself): + # + # - Q: font? + # A: use fontconfig. + # + # - Q: WezTerm? + # A: - I don't use it. + # - I don't know Lua. + # - extraConfig is probably not enough if you want customize it yourself. + # + # - Q: which terminal should I use? + # A: - Alacritty - rusty + # - Foot - fast + # - Kitty - feature rich + # + # - Q: why does kitty's font look bold + # A: I dont know, might be related to this: https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.text_composition_strategy + + options = { + myFlake.home-manager.terminal = { + cursorStyle = lib.mkOption { + type = lib.types.enum ["block" "beam" "underline"]; + default = "beam"; + example = "block"; + description = "Select desired terminal cursor style."; + }; + + fontSize = lib.mkOption { + type = lib.types.int; + default = 12; + example = 8; + description = "Select desired terminal font size."; + }; + + padding = lib.mkOption { + type = lib.types.int; + default = 12; + example = 8; + description = "Select desired terminal padding size (in px)."; + }; + + colorScheme = lib.mkOption { + type = lib.types.enum [null "tokyonight"]; + default = "tokyonight"; + description = "Select desired terminal color scheme."; + }; + }; + }; + + config.programs = lib.mkMerge [ + { + alacritty.settings.cursor.style = cfg.cursorStyle; + kitty.settings.cursor_shape = cfg.cursorStyle; + foot.settings.cursor.style = cfg.cursorStyle; + + alacritty.settings.font.size = cfg.fontSize; + kitty.settings.font_size = cfg.fontSize; + foot.settings.main.font = "monospace:size=${builtins.toString cfg.fontSize}"; + + alacritty.settings.window.padding.x = cfg.padding; + alacritty.settings.window.padding.y = cfg.padding; + kitty.settings.window_padding_width = builtins.toString (cfg.padding * (3.0 / 4.0)); # px -> pt + foot.settings.main.pad = "${builtins.toString cfg.padding}x${builtins.toString cfg.padding}"; + } + + # TODO: split this part to ./color-scheme.nix (???) + (lib.mkIf (cfg.colorScheme == "tokyonight") { + alacritty.settings.import = ["${pkgs.vimPlugins.tokyonight-nvim}/extras/alacritty/tokyonight_night.yml"]; + kitty.settings.include = "${pkgs.vimPlugins.tokyonight-nvim}/extras/kitty/tokyonight_night.conf"; + foot.settings.main.include = "${pkgs.vimPlugins.tokyonight-nvim}/extras/foot/tokyonight_night.ini"; + }) + ]; +} diff --git a/users/guanranwang/home-manager/default.nix b/users/guanranwang/home-manager/default.nix index 97138e5..8fba198 100644 --- a/users/guanranwang/home-manager/default.nix +++ b/users/guanranwang/home-manager/default.nix @@ -23,4 +23,8 @@ # Let Home Manager install and manage itself. programs.home-manager.enable = true; + + imports = [ + ./actual-modules + ]; } diff --git a/users/guanranwang/home-manager/modules/terms/alacritty.nix b/users/guanranwang/home-manager/modules/terms/alacritty.nix index cf915e4..33c4b86 100644 --- a/users/guanranwang/home-manager/modules/terms/alacritty.nix +++ b/users/guanranwang/home-manager/modules/terms/alacritty.nix @@ -1,40 +1,6 @@ -{ - lib, - pkgs, - ... -}: { +{...}: { programs.alacritty = { enable = true; - settings = { - import = ["${pkgs.vimPlugins.tokyonight-nvim}/extras/alacritty/tokyonight_night.yml"]; - cursor.style = "beam"; - env.WINIT_X11_SCALE_FACTOR = "1"; - window = { - #opacity = 0.9; - padding = { - x = 12; - y = 12; - }; - }; - font = { - size = 12; - normal = { - family = lib.mkDefault "monospace"; # macOS dont have fontconfig, so mkDefault is nessesary - style = "SemiBold"; - }; - bold = { - family = lib.mkDefault "monospace"; - style = "Bold"; - }; - bold_italic = { - family = lib.mkDefault "monospace"; - style = "Bold Itailc"; - }; - italic = { - family = lib.mkDefault "monospace"; - style = "SemiBold Italic"; - }; - }; - }; + #settings.env.WINIT_X11_SCALE_FACTOR = "1"; # workaround for.. something? }; } diff --git a/users/guanranwang/home-manager/modules/terms/foot.nix b/users/guanranwang/home-manager/modules/terms/foot.nix index 1ede17a..9b17e0e 100644 --- a/users/guanranwang/home-manager/modules/terms/foot.nix +++ b/users/guanranwang/home-manager/modules/terms/foot.nix @@ -1,34 +1,5 @@ {...}: { programs.foot = { enable = true; - settings = { - font = "monospace:size=12"; - pad = "12x12 center"; - colors = { - #"alpha" = 0.9; - - # Tokyonight - "background" = "1a1b26"; - "foreground" = "c0caf5"; - "regular0" = "15161e"; # black - "regular1" = "f7768e"; # red - "regular2" = "9ece6a"; # green - "regular3" = "e0af68"; # yellow - "regular4" = "7aa2f7"; # blue - "regular5" = "bb9af7"; # magenta - "regular6" = "7dcfff"; # cyan - "regular7" = "a91bd6"; # white - "bright0" = "414868"; # bright black - "bright1" = "f7768e"; # bright red - "bright2" = "9ece6a"; # bright green - "bright3" = "e0af68"; # bright yellow - "bright4" = "7aa2f7"; # bright blue - "bright5" = "bb9af7"; # bright magenta - "bright6" = "7dcfff"; # bright cyan - "bright7" = "c0caf5"; # bright white - "16" = "ff9e64"; - "17" = "db4b4b"; - }; - }; }; } diff --git a/users/guanranwang/home-manager/modules/terms/kitty.nix b/users/guanranwang/home-manager/modules/terms/kitty.nix index 4735265..a2f392e 100644 --- a/users/guanranwang/home-manager/modules/terms/kitty.nix +++ b/users/guanranwang/home-manager/modules/terms/kitty.nix @@ -1,12 +1,6 @@ -{pkgs, ...}: { +{...}: { programs.kitty = { enable = true; - settings = { - include = "${pkgs.vimPlugins.tokyonight-nvim}/extras/kitty/tokyonight_night.conf"; - font_size = 12; - confirm_os_window_close = 0; - window_padding_width = 6; - adjust_line_height = 0; - }; + settings.confirm_os_window_close = 0; }; }