diff --git a/users/guanranwang/home-manager/actual-modules/color-scheme.nix b/users/guanranwang/home-manager/actual-modules/color-scheme.nix new file mode 100644 index 0000000..f166149 --- /dev/null +++ b/users/guanranwang/home-manager/actual-modules/color-scheme.nix @@ -0,0 +1,9 @@ +{lib, ...}: { + options.myFlake.home-manager = { + colorScheme = lib.mkOption { + type = lib.types.enum [null "tokyonight"]; + default = "tokyonight"; + description = "Select desired terminal color scheme."; + }; + }; +} diff --git a/users/guanranwang/home-manager/actual-modules/default.nix b/users/guanranwang/home-manager/actual-modules/default.nix index af93534..c27cb68 100644 --- a/users/guanranwang/home-manager/actual-modules/default.nix +++ b/users/guanranwang/home-manager/actual-modules/default.nix @@ -1,5 +1,6 @@ {...}: { imports = [ ./terminal.nix + ./color-scheme.nix ]; } diff --git a/users/guanranwang/home-manager/actual-modules/terminal.nix b/users/guanranwang/home-manager/actual-modules/terminal.nix index b868eca..73b55a2 100644 --- a/users/guanranwang/home-manager/actual-modules/terminal.nix +++ b/users/guanranwang/home-manager/actual-modules/terminal.nix @@ -1,11 +1,4 @@ -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.myFlake.home-manager.terminal; -in { +{lib, ...}: { # 3 terminals, one module. # -- The Orange Box (wtf) @@ -49,36 +42,6 @@ in { 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/modules/editor/helix.nix b/users/guanranwang/home-manager/modules/editor/helix.nix index ba8c8ea..3b8fd94 100644 --- a/users/guanranwang/home-manager/modules/editor/helix.nix +++ b/users/guanranwang/home-manager/modules/editor/helix.nix @@ -1,9 +1,15 @@ -{...}: { +{ + config, + lib, + ... +}: { programs.helix = { enable = true; defaultEditor = true; settings = { - theme = "tokyonight"; + theme = + lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") + "tokyonight"; editor = { cursor-shape = { insert = "bar"; diff --git a/users/guanranwang/home-manager/modules/editor/vscode.nix b/users/guanranwang/home-manager/modules/editor/vscode.nix index f3d5528..975beaa 100644 --- a/users/guanranwang/home-manager/modules/editor/vscode.nix +++ b/users/guanranwang/home-manager/modules/editor/vscode.nix @@ -1,71 +1,73 @@ { lib, pkgs, + config, ... }: { - programs.vscode = { - enable = true; - package = pkgs.vscodium; # foss - enableExtensionUpdateCheck = false; - enableUpdateCheck = false; - keybindings = [ - { - key = "tab"; - command = "selectNextSuggestion"; - when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"; - } - { - key = "shift+tab"; - command = "selectPrevSuggestion"; - when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"; - } - ]; - userSettings = { - diffEditor.ignoreTrimWhitespace = false; - editor.cursorBlinking = "smooth"; - editor.cursorSmoothCaretAnimation = "on"; - editor.fontFamily = lib.mkDefault "Monospace"; - editor.fontWeight = 600; - editor.smoothScrolling = true; - editor.tabSize = 2; - explorer.confirmDragAndDrop = false; - explorer.confirmDelete = false; - files.autoSave = "onFocusChange"; - files.trimTrailingWhitespace = true; - files.trimFinalNewlines = true; - security.workspace.trust.enabled = false; - telemetry.telemetryLevel = "off"; - terminal.integrated.cursorStyle = "line"; - terminal.integrated.smoothScrolling = true; - window.menuBarVisibility = "toggle"; - workbench.colorTheme = "Tokyo Night"; - workbench.list.smoothScrolling = true; + programs.vscode = lib.mkMerge [ + { + enable = true; + package = pkgs.vscodium; # foss + enableExtensionUpdateCheck = false; + enableUpdateCheck = false; + keybindings = [ + { + key = "tab"; + command = "selectNextSuggestion"; + when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"; + } + { + key = "shift+tab"; + command = "selectPrevSuggestion"; + when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus || suggestWidgetVisible && textInputFocus && !suggestWidgetHasFocusedSuggestion"; + } + ]; + userSettings = { + diffEditor.ignoreTrimWhitespace = false; + editor.cursorBlinking = "smooth"; + editor.cursorSmoothCaretAnimation = "on"; + editor.fontFamily = lib.mkDefault "Monospace"; + editor.fontWeight = 600; + editor.smoothScrolling = true; + editor.tabSize = 2; + explorer.confirmDragAndDrop = false; + explorer.confirmDelete = false; + files.autoSave = "onFocusChange"; + files.trimTrailingWhitespace = true; + files.trimFinalNewlines = true; + security.workspace.trust.enabled = false; + telemetry.telemetryLevel = "off"; + terminal.integrated.cursorStyle = "line"; + terminal.integrated.smoothScrolling = true; + window.menuBarVisibility = "toggle"; + workbench.list.smoothScrolling = true; - # Workaround for VSCode crashing - # https://github.com/microsoft/vscode/issues/184124 - window.titleBarStyle = "custom"; - workbench.layoutControl.enabled = false; - window.commandCenter = false; + # Workaround for VSCode crashing + # https://github.com/microsoft/vscode/issues/184124 + window.titleBarStyle = "custom"; + workbench.layoutControl.enabled = false; + window.commandCenter = false; - # Language specific - ### Nix - "[nix]".editor.tabSize = 2; + # Language specific + ### Nix + "[nix]".editor.tabSize = 2; - # Extensions - ### GitLens - gitlens.telemetry.enabled = false; - }; - extensions = with pkgs.vscode-extensions; [ - ### QoL - eamodio.gitlens - esbenp.prettier-vscode - ritwickdey.liveserver - vscodevim.vim + # Extensions + ### GitLens + gitlens.telemetry.enabled = false; + }; + extensions = with pkgs.vscode-extensions; [ + ### QoL + eamodio.gitlens + esbenp.prettier-vscode + ritwickdey.liveserver + vscodevim.vim + ]; + } - ### Themes - enkia.tokyo-night - #catppuccin.catppuccin-vsc-icons - #catppuccin.catppuccin-vsc - ]; - }; + (lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") { + extensions = [pkgs.vscode-extensions.enkia.tokyo-night]; + userSettings.workbench.colorTheme = "Tokyo Night"; + }) + ]; } diff --git a/users/guanranwang/home-manager/modules/shell/fish.nix b/users/guanranwang/home-manager/modules/shell/fish.nix index 013e339..00f3871 100644 --- a/users/guanranwang/home-manager/modules/shell/fish.nix +++ b/users/guanranwang/home-manager/modules/shell/fish.nix @@ -1,9 +1,15 @@ -{pkgs, ...}: { +{ + pkgs, + config, + lib, + ... +}: { programs.fish = { enable = true; interactiveShellInit = '' set fish_greeting - source ${pkgs.vimPlugins.tokyonight-nvim}/extras/fish/tokyonight_night.fish + ${lib.strings.optionalString (config.myFlake.home-manager.colorScheme == "tokyonight") + "source ${pkgs.vimPlugins.tokyonight-nvim}/extras/fish/tokyonight_night.fish"} ''; plugins = [ { diff --git a/users/guanranwang/home-manager/modules/terms/alacritty.nix b/users/guanranwang/home-manager/modules/terms/alacritty.nix index 33c4b86..69cb350 100644 --- a/users/guanranwang/home-manager/modules/terms/alacritty.nix +++ b/users/guanranwang/home-manager/modules/terms/alacritty.nix @@ -1,6 +1,23 @@ -{...}: { +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myFlake.home-manager.terminal; +in { programs.alacritty = { enable = true; - #settings.env.WINIT_X11_SCALE_FACTOR = "1"; # workaround for.. something? + settings = { + import = + lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") + ["${pkgs.vimPlugins.tokyonight-nvim}/extras/alacritty/tokyonight_night.yml"]; + cursor.style = cfg.cursorStyle; + font.size = cfg.fontSize; + window.padding.x = cfg.padding; + window.padding.y = cfg.padding; + + #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 9b17e0e..39d8add 100644 --- a/users/guanranwang/home-manager/modules/terms/foot.nix +++ b/users/guanranwang/home-manager/modules/terms/foot.nix @@ -1,5 +1,20 @@ -{...}: { - programs.foot = { +{ + lib, + config, + pkgs, + ... +}: { + programs.foot = let + cfg = config.myFlake.home-manager.terminal; + in { enable = true; + settings = { + main.include = + lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") + "${pkgs.vimPlugins.tokyonight-nvim}/extras/foot/tokyonight_night.ini"; + cursor.style = cfg.cursorStyle; + main.font = "monospace:size=${builtins.toString cfg.fontSize}"; + main.pad = "${builtins.toString cfg.padding}x${builtins.toString cfg.padding}"; + }; }; } diff --git a/users/guanranwang/home-manager/modules/terms/kitty.nix b/users/guanranwang/home-manager/modules/terms/kitty.nix index a2f392e..d179de3 100644 --- a/users/guanranwang/home-manager/modules/terms/kitty.nix +++ b/users/guanranwang/home-manager/modules/terms/kitty.nix @@ -1,6 +1,22 @@ -{...}: { +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myFlake.home-manager.terminal; +in { programs.kitty = { enable = true; - settings.confirm_os_window_close = 0; + settings = { + include = + lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") + "${pkgs.vimPlugins.tokyonight-nvim}/extras/kitty/tokyonight_night.conf"; + cursor_shape = cfg.cursorStyle; + font_size = cfg.fontSize; + window_padding_width = builtins.toString (cfg.padding * (3.0 / 4.0)); # px -> pt + + confirm_os_window_close = 0; + }; }; } diff --git a/users/guanranwang/home-manager/modules/wm/components/dunst.nix b/users/guanranwang/home-manager/modules/wm/components/dunst.nix index 9659ebb..f9494aa 100644 --- a/users/guanranwang/home-manager/modules/wm/components/dunst.nix +++ b/users/guanranwang/home-manager/modules/wm/components/dunst.nix @@ -1,27 +1,33 @@ -{...}: { +{ + lib, + config, + ... +}: { services.dunst = { enable = true; - settings = { - global = { - padding = 10; - horizontal_padding = 10; - frame_width = 2; - font = "Monospace 10"; - icon_path = "/home/guanranwang/.local/share/icons/dunst"; - corner_radius = 10; + settings = lib.mkMerge [ + { + global = { + padding = 10; + horizontal_padding = 10; + frame_width = 2; + font = "Monospace 10"; + icon_path = "/home/guanranwang/.local/share/icons/dunst"; + corner_radius = 10; - max_icon_size = 128; # weird bug, default value (128) not working - }; - - # Tokyonight - global = { - frame_color = "#c0caf5"; - background = "#1a1b26"; - foreground = "#c0caf5"; - }; - - urgency_critical.frame_color = "#fab387"; - }; + max_icon_size = 128; # weird bug, default value (128) not working + }; + } + (lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") { + # Tokyonight + global = { + frame_color = "#c0caf5"; + background = "#1a1b26"; + foreground = "#c0caf5"; + }; + urgency_critical.frame_color = "#fab387"; + }) + ]; }; xdg.dataFile."icons/dunst" = { diff --git a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/theme.nix b/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/theme.nix index ee9ad92..a1be232 100644 --- a/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/theme.nix +++ b/users/guanranwang/home-manager/profiles/graphical-stuff/nixos/theme.nix @@ -1,6 +1,7 @@ { pkgs, config, + lib, ... }: { gtk.enable = true; @@ -65,39 +66,42 @@ }; # Misc - xresources.properties = { - # Cursor - "Xcursor.theme" = "Adwaita"; + xresources.properties = lib.mkMerge [ + { + # Cursor + "Xcursor.theme" = "Adwaita"; - # Fonts - "Xft.autohint" = "0"; - "Xft.lcdfilter" = "lcddefault"; - "Xft.hintstyle" = "hintslight"; - "Xft.hinting" = "1"; - "Xft.antialias" = "1"; - "Xft.rgba" = "rgb"; + # Fonts + "Xft.autohint" = "0"; + "Xft.lcdfilter" = "lcddefault"; + "Xft.hintstyle" = "hintslight"; + "Xft.hinting" = "1"; + "Xft.antialias" = "1"; + "Xft.rgba" = "rgb"; + } + (lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") { + # Tokyonight color scheme + # i have no idea what does it apply to + "*background" = "#1a1b26"; + "*foreground" = "#c0caf5"; - # Tokyonight color scheme - # i have no idea what does it apply to - "*background" = "#1a1b26"; - "*foreground" = "#c0caf5"; + "*color0" = "#15161e"; + "*color1" = "#f7768e"; + "*color2" = "#9ece6a"; + "*color3" = "#e0af68"; + "*color4" = "#7aa2f7"; + "*color5" = "#bb9af7"; + "*color6" = "#7dcfff"; + "*color7" = "#a9b1d6"; - "*color0" = "#15161e"; - "*color1" = "#f7768e"; - "*color2" = "#9ece6a"; - "*color3" = "#e0af68"; - "*color4" = "#7aa2f7"; - "*color5" = "#bb9af7"; - "*color6" = "#7dcfff"; - "*color7" = "#a9b1d6"; - - "*color8" = "#414868"; - "*color9" = "#f7768e"; - "*color10" = "#9ece6a"; - "*color11" = "#e0af68"; - "*color12" = "#7aa2f7"; - "*color13" = "#bb9af7"; - "*color14" = "#7dcfff"; - "*color15" = "#c0caf5"; - }; + "*color8" = "#414868"; + "*color9" = "#f7768e"; + "*color10" = "#9ece6a"; + "*color11" = "#e0af68"; + "*color12" = "#7aa2f7"; + "*color13" = "#bb9af7"; + "*color14" = "#7dcfff"; + "*color15" = "#c0caf5"; + }) + ]; }