home, modules: add myFlake.home-manager.colorScheme

This commit is contained in:
Guanran Wang 2023-11-23 14:05:54 +08:00
parent b07b91d6b6
commit 65a4e1e46a
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
11 changed files with 207 additions and 162 deletions

View file

@ -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.";
};
};
}

View file

@ -1,5 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
./terminal.nix ./terminal.nix
./color-scheme.nix
]; ];
} }

View file

@ -1,11 +1,4 @@
{ {lib, ...}: {
lib,
config,
pkgs,
...
}: let
cfg = config.myFlake.home-manager.terminal;
in {
# 3 terminals, one module. # 3 terminals, one module.
# -- The Orange Box (wtf) # -- The Orange Box (wtf)
@ -49,36 +42,6 @@ in {
example = 8; example = 8;
description = "Select desired terminal padding size (in px)."; 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";
})
];
} }

View file

@ -1,9 +1,15 @@
{...}: { {
config,
lib,
...
}: {
programs.helix = { programs.helix = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
settings = { settings = {
theme = "tokyonight"; theme =
lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight")
"tokyonight";
editor = { editor = {
cursor-shape = { cursor-shape = {
insert = "bar"; insert = "bar";

View file

@ -1,9 +1,11 @@
{ {
lib, lib,
pkgs, pkgs,
config,
... ...
}: { }: {
programs.vscode = { programs.vscode = lib.mkMerge [
{
enable = true; enable = true;
package = pkgs.vscodium; # foss package = pkgs.vscodium; # foss
enableExtensionUpdateCheck = false; enableExtensionUpdateCheck = false;
@ -38,7 +40,6 @@
terminal.integrated.cursorStyle = "line"; terminal.integrated.cursorStyle = "line";
terminal.integrated.smoothScrolling = true; terminal.integrated.smoothScrolling = true;
window.menuBarVisibility = "toggle"; window.menuBarVisibility = "toggle";
workbench.colorTheme = "Tokyo Night";
workbench.list.smoothScrolling = true; workbench.list.smoothScrolling = true;
# Workaround for VSCode crashing # Workaround for VSCode crashing
@ -61,11 +62,12 @@
esbenp.prettier-vscode esbenp.prettier-vscode
ritwickdey.liveserver ritwickdey.liveserver
vscodevim.vim 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";
})
];
} }

View file

@ -1,9 +1,15 @@
{pkgs, ...}: { {
pkgs,
config,
lib,
...
}: {
programs.fish = { programs.fish = {
enable = true; enable = true;
interactiveShellInit = '' interactiveShellInit = ''
set fish_greeting 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 = [ plugins = [
{ {

View file

@ -1,6 +1,23 @@
{...}: { {
lib,
config,
pkgs,
...
}: let
cfg = config.myFlake.home-manager.terminal;
in {
programs.alacritty = { programs.alacritty = {
enable = true; 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?
};
}; };
} }

View file

@ -1,5 +1,20 @@
{...}: { {
programs.foot = { lib,
config,
pkgs,
...
}: {
programs.foot = let
cfg = config.myFlake.home-manager.terminal;
in {
enable = true; 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}";
};
}; };
} }

View file

@ -1,6 +1,22 @@
{...}: { {
lib,
config,
pkgs,
...
}: let
cfg = config.myFlake.home-manager.terminal;
in {
programs.kitty = { programs.kitty = {
enable = true; 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;
};
}; };
} }

View file

@ -1,7 +1,12 @@
{...}: { {
lib,
config,
...
}: {
services.dunst = { services.dunst = {
enable = true; enable = true;
settings = { settings = lib.mkMerge [
{
global = { global = {
padding = 10; padding = 10;
horizontal_padding = 10; horizontal_padding = 10;
@ -12,16 +17,17 @@
max_icon_size = 128; # weird bug, default value (128) not working max_icon_size = 128; # weird bug, default value (128) not working
}; };
}
(lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") {
# Tokyonight # Tokyonight
global = { global = {
frame_color = "#c0caf5"; frame_color = "#c0caf5";
background = "#1a1b26"; background = "#1a1b26";
foreground = "#c0caf5"; foreground = "#c0caf5";
}; };
urgency_critical.frame_color = "#fab387"; urgency_critical.frame_color = "#fab387";
}; })
];
}; };
xdg.dataFile."icons/dunst" = { xdg.dataFile."icons/dunst" = {

View file

@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
config, config,
lib,
... ...
}: { }: {
gtk.enable = true; gtk.enable = true;
@ -65,7 +66,8 @@
}; };
# Misc # Misc
xresources.properties = { xresources.properties = lib.mkMerge [
{
# Cursor # Cursor
"Xcursor.theme" = "Adwaita"; "Xcursor.theme" = "Adwaita";
@ -76,7 +78,8 @@
"Xft.hinting" = "1"; "Xft.hinting" = "1";
"Xft.antialias" = "1"; "Xft.antialias" = "1";
"Xft.rgba" = "rgb"; "Xft.rgba" = "rgb";
}
(lib.mkIf (config.myFlake.home-manager.colorScheme == "tokyonight") {
# Tokyonight color scheme # Tokyonight color scheme
# i have no idea what does it apply to # i have no idea what does it apply to
"*background" = "#1a1b26"; "*background" = "#1a1b26";
@ -99,5 +102,6 @@
"*color13" = "#bb9af7"; "*color13" = "#bb9af7";
"*color14" = "#7dcfff"; "*color14" = "#7dcfff";
"*color15" = "#c0caf5"; "*color15" = "#c0caf5";
}; })
];
} }