From 482bcef47a3b7ee63553c58d200065857ec42b1c Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sat, 2 Mar 2024 20:30:02 +0300 Subject: 2024-03-02 --- modules/common/alacritty.nix | 96 +---------------- modules/common/bat.nix | 1 - modules/common/common/default.nix | 1 + modules/common/common/nix.nix | 2 - modules/common/common/stylix.nix | 68 ++++++++++++ modules/common/default.nix | 1 - modules/common/emacs/default.nix | 8 +- modules/common/emacs/doom/config.el | 6 +- modules/common/fonts.nix | 95 ----------------- modules/common/profiles/default.nix | 48 +-------- modules/common/profiles/dev/sql.nix | 33 +++--- modules/common/qutebrowser.nix | 202 ------------------------------------ modules/common/vim/default.nix | 2 + modules/common/vscode.nix | 47 +++------ modules/common/zathura.nix | 125 ++++++++-------------- 15 files changed, 159 insertions(+), 576 deletions(-) create mode 100644 modules/common/common/stylix.nix delete mode 100644 modules/common/fonts.nix (limited to 'modules/common') diff --git a/modules/common/alacritty.nix b/modules/common/alacritty.nix index be3af21..892516b 100644 --- a/modules/common/alacritty.nix +++ b/modules/common/alacritty.nix @@ -12,104 +12,16 @@ in { config = mkIf cfg.enable { hm.programs.alacritty = { enable = true; - settings = with config.nixfiles.modules; { + settings = { window = { - padding = with config.fontScheme.monospaceFont; { - x = size; - y = size; + padding = with config.stylix.fonts.sizes; { + x = terminal; + y = terminal; }; dynamic_padding = false; decorations = "Full"; startup_mode = "Maximized"; }; - font = with config.fontScheme.monospaceFont; { - normal = { - inherit family; - style = "Regular"; - }; - bold = { - inherit family; - style = "Bold"; - }; - italic = { - inherit family; - style = "Italic"; - }; - bold_italic = { - inherit family; - style = "Bold Italic"; - }; - inherit size; - }; - colors = with config.colourScheme; { - primary = { - inherit background foreground; - dim_foreground = "None"; - bright_foreground = "None"; - }; - cursor = { - text = "CellBackground"; - cursor = "CellForeground"; - }; - vi_mode_cursor = { - text = "CellBackground"; - cursor = "CellForeground"; - }; - search = { - matches = { - foreground = white; - background = red; - }; - focused_match = { - foreground = red; - background = black; - }; - }; - hints = { - start = { - foreground = black; - background = yellow; - }; - end = { - foreground = yellow; - background = black; - }; - }; - line_indicator = { - foreground = "None"; - background = "None"; - }; - footer_bar = { - foreground = black; - background = white; - }; - selection = { - text = "CellBackground"; - background = "CellForeground"; - }; - normal = { - inherit - black - red - green - yellow - blue - magenta - cyan - white - ; - }; - bright = { - black = brightBlack; - red = brightRed; - green = brightGreen; - yellow = brightYellow; - blue = brightBlue; - magenta = brightMagenta; - cyan = brightCyan; - white = brightWhite; - }; - }; selection.save_to_clipboard = true; cursor = { style = { diff --git a/modules/common/bat.nix b/modules/common/bat.nix index 2dc0913..89444d9 100644 --- a/modules/common/bat.nix +++ b/modules/common/bat.nix @@ -21,7 +21,6 @@ in { config = { style = "plain"; tabs = "4"; - theme = "base16"; wrap = "never"; }; }; diff --git a/modules/common/common/default.nix b/modules/common/common/default.nix index 0087754..62e4a95 100644 --- a/modules/common/common/default.nix +++ b/modules/common/common/default.nix @@ -7,6 +7,7 @@ _: { ./nix.nix ./secrets.nix ./shell + ./stylix.nix ./users.nix ./xdg.nix ]; diff --git a/modules/common/common/nix.nix b/modules/common/common/nix.nix index 78672a0..ecd5874 100644 --- a/modules/common/common/nix.nix +++ b/modules/common/common/nix.nix @@ -4,7 +4,6 @@ lib, localUsername ? lib.my.username, pkgs, - pkgsPr, this, ... }: @@ -90,7 +89,6 @@ with lib; { nixpkgs.overlays = with inputs; [ self.overlays.default (_: _: { - inherit (pkgsPr 274745 "sha256-VqBdz6OERQ7dUxWVG+aAeKWuRoPIgfZPipfNdX122WM=") beets-unstable; }) ]; diff --git a/modules/common/common/stylix.nix b/modules/common/common/stylix.nix new file mode 100644 index 0000000..46b1f52 --- /dev/null +++ b/modules/common/common/stylix.nix @@ -0,0 +1,68 @@ +{ + lib, + pkgs, + ... +}: +with lib; { + imports = [ + (mkAliasOptionModule ["colors"] [ + "lib" + "stylix" + "colors" + ]) + ]; + + options.nixfiles.modules.common.stylix.fonts.extraPackages = mkOption { + description = "Font packages."; + default = with pkgs; [ + font-awesome + noto-fonts + noto-fonts-emoji + sarasa-gothic + source-han-mono + source-han-sans + source-han-serif + ]; + readOnly = true; + }; + + config = { + stylix = { + image = pkgs.fetchurl { + url = "https://upload.wikimedia.org/wikipedia/commons/a/a5/Bonaparte_ante_la_Esfinge%2C_por_Jean-Léon_Gérôme.jpg"; + sha256 = "sha256-qWv52oT8cF9K4ZoeawmR3jgoGB2ARfjbKKc12IljUcM="; + }; + + base16Scheme = "${pkgs.base16-schemes}/share/themes/default-dark.yaml"; + + fonts = { + serif = { + package = pkgs.iosevka-bin.override {variant = "etoile";}; + name = "Iosevka Etoile"; + }; + + sansSerif = { + package = pkgs.iosevka-bin.override {variant = "aile";}; + name = "Iosevka Aile"; + }; + + monospace = { + package = pkgs.iosevka-bin; + name = "Iosevka"; + }; + + sizes = { + desktop = 10; + applications = 10; + terminal = 12; + }; + }; + + cursor = { + name = "phinger-cursors"; + package = pkgs.phinger-cursors; + size = 32; + }; + }; + }; +} diff --git a/modules/common/default.nix b/modules/common/default.nix index c6c7c81..92f719d 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -9,7 +9,6 @@ _: { ./editorconfig.nix ./emacs ./eza.nix - ./fonts.nix ./git.nix ./gnupg.nix ./htop.nix diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix index 4d17e92..6c5ee1e 100644 --- a/modules/common/emacs/default.nix +++ b/modules/common/emacs/default.nix @@ -19,7 +19,6 @@ in { }; nixfiles.modules = { - fonts.enable = true; git.client.enable = true; gnupg.enable = true; password-store.enable = true; @@ -28,6 +27,8 @@ in { }; hm = { + stylix.targets.emacs.enable = false; + xdg.configFile = mapAttrs (_: value: value // { @@ -171,10 +172,9 @@ in { (appendq! auth-sources '(("${config.secrets.authinfo.path}"))) - ;; The font must be set to n+2, otherwise it looks too small. (setq doom-font (font-spec - :family "${config.fontScheme.monospaceFont.family}" - :size ${toString (config.fontScheme.monospaceFont.size + 2)}) + :family "${config.stylix.fonts.monospace.name}" + :size 16) doom-unicode-font doom-font) ;; :input japanese diff --git a/modules/common/emacs/doom/config.el b/modules/common/emacs/doom/config.el index 8fd2afc..9e3d603 100644 --- a/modules/common/emacs/doom/config.el +++ b/modules/common/emacs/doom/config.el @@ -9,7 +9,7 @@ scroll-margin 10 hscroll-margin 10) -(when IS-LINUX +(when (featurep :system 'linux) (setq browse-url-generic-program (executable-find "firefox") browse-url-browser-function 'browse-url-generic)) @@ -17,7 +17,7 @@ ;;; Doom-specific ;; -(setq doom-theme 'doom-tomorrow-night +(setq doom-theme 'modus-vivendi doom-modeline-icon nil doom-modeline-indent-info t doom-modeline-total-line-number t @@ -190,7 +190,7 @@ :tls t :user ,(concat circe-default-user "/" server) :pass ,(lambda (&rest _) - (+pass-get-secret "server/soju.manwe.shire.net/azahi")))) + (+pass-get-secret "")))) '("libera" "oftc" "hackint" "rizon"))) ;; diff --git a/modules/common/fonts.nix b/modules/common/fonts.nix deleted file mode 100644 index 6bd3e71..0000000 --- a/modules/common/fonts.nix +++ /dev/null @@ -1,95 +0,0 @@ -{ - lib, - pkgs, - ... -}: -with lib; { - imports = [ - (mkAliasOptionModule ["fontScheme"] [ - "nixfiles" - "modules" - "fonts" - "fontScheme" - ]) - ]; - - options.nixfiles.modules.fonts = { - enable = mkEnableOption "fonts and their configurations"; - - packages = mkOption { - description = "Font packages to install."; - type = with types; listOf package; - default = with pkgs; [ - (iosevka-bin.override {variant = "aile";}) - (iosevka-bin.override {variant = "etoile";}) - iosevka-bin - sarasa-gothic - source-han-mono - source-han-sans - source-han-serif - noto-fonts - font-awesome - ]; - }; - - fontScheme = let - mkFont = { - family, - style, - size, - }: { - family = mkOption { - description = "Family of the font."; - type = types.str; - default = family; - }; - style = mkOption { - description = "Style of the font."; - type = types.str; - default = style; - }; - size = mkOption { - description = "Size of the font."; - type = types.int; - default = size; - }; - }; - in { - serifFont = mkFont { - family = "Iosevka Etoile"; - style = "Regular"; - size = 14; - }; - - serifFontFallback = mkFont { - family = "Sarasa Gothic J"; - style = "Regular"; - size = 14; - }; - - sansSerifFont = mkFont { - family = "Iosevka Aile"; - style = "Regular"; - size = 14; - }; - - sansSerifFontFallback = mkFont { - family = "Sarasa Gothic J"; - style = "Regular"; - size = 14; - }; - - monospaceFont = mkFont { - family = "Iosevka"; - style = "Regular"; - size = 14; - }; - - monospaceFontFallback = mkFont { - family = "Sarasa Mono J"; - style = "Regular"; - size = 14; - }; - }; - }; -} diff --git a/modules/common/profiles/default.nix b/modules/common/profiles/default.nix index 2b24752..a17ff08 100644 --- a/modules/common/profiles/default.nix +++ b/modules/common/profiles/default.nix @@ -13,53 +13,13 @@ in { ./email.nix ./headful.nix ./headless.nix - (mkAliasOptionModule ["colourScheme"] [ - "nixfiles" - "modules" - "profiles" - "default" - "colourScheme" - ]) ]; - options.nixfiles.modules.profiles.default = { - enable = - mkEnableOption "The most default profile of them all." - // { - default = true; - }; - - colourScheme = let - mkColour = default: - mkOption { - type = types.str; - inherit default; - description = "Colour in a standard hexadecimal notation."; - example = "#000000"; - }; - in rec { - black = mkColour "#161719"; - red = mkColour "#cc6666"; - green = mkColour "#b5bd68"; - yellow = mkColour "#f0c674"; - blue = mkColour "#81a2be"; - magenta = mkColour "#b294bb"; - cyan = mkColour "#8abeb7"; - white = mkColour "#c5c8c6"; - - brightBlack = mkColour "#969896"; - brightRed = mkColour "#cc6666"; - brightGreen = mkColour "#b5bd68"; - brightYellow = mkColour "#f0c674"; - brightBlue = mkColour "#81a2be"; - brightMagenta = mkColour "#b294bb"; - brightCyan = mkColour "#8abeb7"; - brightWhite = mkColour "#ffffff"; - - background = black; - foreground = white; + options.nixfiles.modules.profiles.default.enable = + mkEnableOption "The most default profile of them all." + // { + default = true; }; - }; config = mkIf cfg.enable { assertions = [ diff --git a/modules/common/profiles/dev/sql.nix b/modules/common/profiles/dev/sql.nix index b290c16..3e1c4b2 100644 --- a/modules/common/profiles/dev/sql.nix +++ b/modules/common/profiles/dev/sql.nix @@ -16,7 +16,6 @@ in { config = mkIf cfg.enable { hm = { home.packages = with pkgs; [ - dbeaver pgcli litecli ]; @@ -34,26 +33,26 @@ in { table_format = "fancy_grid"; }; - colorsSection = with config.colourScheme; { + colorsSection = with config.colors.withHashtag; { "arg-toolbar" = "noinherit bold"; "arg-toolbar.text" = "nobold"; - "bottom-toolbar" = "bg:${black} ${white}"; - "bottom-toolbar.off" = "bg:${black} ${brightBlack}"; - "bottom-toolbar.on" = "bg:${black} ${brightWhite}"; - "bottom-toolbar.transaction.failed" = "bg:${black} ${red} bold"; - "bottom-toolbar.transaction.valid" = "bg:${black} ${green} bold"; - "completion-menu.completion" = "bg:${black} ${white}"; - "completion-menu.completion.current" = "bg:${white} ${black}"; - "completion-menu.meta.completion" = "bg:${black} ${yellow}"; - "completion-menu.meta.completion.current" = "bg:${yellow} ${black}"; - "completion-menu.multi-column-meta" = "bg:${yellow} ${black}"; - "scrollbar" = "bg:${black}"; - "scrollbar.arrow" = "bg:${black}"; - "search" = "bg:${magenta} ${brightWhite}"; + "bottom-toolbar" = "bg:${base01} ${base06}"; + "bottom-toolbar.off" = "bg:${base01} ${base02}"; + "bottom-toolbar.on" = "bg:${base01} ${base07}"; + "bottom-toolbar.transaction.failed" = "bg:${base01} ${base08} bold"; + "bottom-toolbar.transaction.valid" = "bg:${base01} ${base0B} bold"; + "completion-menu.completion" = "bg:${base01} ${base06}"; + "completion-menu.completion.current" = "bg:${base06} ${base01}"; + "completion-menu.meta.completion" = "bg:${base01} ${base13}"; + "completion-menu.meta.completion.current" = "bg:${base09} ${base01}"; + "completion-menu.multi-column-meta" = "bg:${base09} ${base01}"; + "scrollbar" = "bg:${base01}"; + "scrollbar.arrow" = "bg:${base01}"; + "search" = "bg:${base17} ${base07}"; "search-toolbar" = "noinherit bold"; "search-toolbar.text" = "nobold"; - "search.current" = "bg:${green} ${brightWhite}"; - "selected" = "bg:${blue} ${brightWhite}"; + "search.current" = "bg:${base14} ${base07}"; + "selected" = "bg:${base0D} ${base07}"; "system-toolbar" = "noinherit bold"; }; diff --git a/modules/common/qutebrowser.nix b/modules/common/qutebrowser.nix index 9a919b7..a3b82d3 100644 --- a/modules/common/qutebrowser.nix +++ b/modules/common/qutebrowser.nix @@ -178,7 +178,6 @@ in { hints = { auto_follow = "unique-match"; auto_follow_timeout = 0; - border = "0px"; min_chars = 1; scatter = false; uppercase = false; @@ -242,207 +241,6 @@ in { title_format = "{perc}{current_title}{title_sep}qutebrowser"; }; - colors = with config.colourScheme; { - completion = rec { - fg = white; - match.fg = red; - odd.bg = black; - even.bg = odd.bg; - category = { - fg = white; - bg = black; - border = { - top = black; - bottom = black; - }; - }; - item.selected = { - fg = black; - bg = white; - border = { - top = white; - bottom = white; - }; - }; - scrollbar = { - fg = white; - bg = black; - }; - }; - contextmenu = { - menu = { - fg = white; - bg = black; - }; - selected = { - fg = black; - bg = white; - }; - disabled = { - fg = brightBlack; - bg = black; - }; - }; - downloads = { - bar.bg = black; - start = { - fg = green; - bg = black; - }; - stop = { - fg = yellow; - bg = black; - }; - error = { - fg = red; - bg = black; - }; - system = { - fg = "none"; - bg = "none"; - }; - }; - hints = { - fg = white; - match.fg = red; - bg = black; - }; - keyhint = { - fg = white; - suffix.fg = red; - bg = black; - }; - messages = { - error = rec { - bg = black; - fg = red; - border = bg; - }; - info = rec { - fg = blue; - bg = black; - border = bg; - }; - warning = rec { - fg = yellow; - bg = black; - border = bg; - }; - }; - prompts = rec { - fg = white; - bg = black; - selected = { - fg = black; - bg = white; - }; - border = bg; - }; - statusbar = { - normal = { - bg = black; - fg = white; - }; - command = { - bg = black; - fg = white; - }; - insert = { - bg = green; - fg = black; - }; - passthrough = { - bg = blue; - fg = black; - }; - private = { - bg = magenta; - fg = black; - }; - url = { - fg = blue; - hover.fg = brightBlue; - success = { - http.fg = brightGreen; - https.fg = brightGreen; - }; - warn.fg = brightYellow; - error.fg = brightRed; - }; - }; - tabs = rec { - bar.bg = black; - even = { - bg = black; - fg = white; - }; - odd = with even; {inherit bg fg;}; - selected = rec { - even = { - bg = white; - fg = black; - }; - odd = with even; {inherit bg fg;}; - }; - pinned = rec { - even = { - bg = brightBlack; - fg = brightWhite; - }; - odd = with even; {inherit bg fg;}; - }; - indicator = { - start = green; - stop = yellow; - error = red; - system = "none"; - }; - }; - webpage = { - bg = "white"; - darkmode.enabled = false; - preferred_color_scheme = "auto"; - }; - }; - - fonts = - (with config.fontScheme.monospaceFont; { - default_family = family; - default_size = (toString size) + "pt"; - }) - // { - web = with config.fontScheme; { - family = rec { - standard = sans_serif; - fixed = monospaceFont.family; - serif = serifFont.family; - sans_serif = sansSerifFont.family; - cursive = null; - fantasy = null; - }; - size = rec { - default = sansSerifFont.size; - default_fixed = monospaceFont.size; - minimum = 0; - minimum_logical = default / 2; - }; - }; - } - // mapListToAttrs (_: "default_size default_family") [ - "completion.category" - "completion.entry" - "contextmenu" - "debug_console" - "downloads" - "hints" - "keyhint" - "messages.error" - "messages.info" - "messages.warning" - "prompts" - "statusbar" - ]; - qt = mkIf kde.enable { force_platform = null; force_platformtheme = "KDE"; diff --git a/modules/common/vim/default.nix b/modules/common/vim/default.nix index cd24768..e305cf1 100644 --- a/modules/common/vim/default.nix +++ b/modules/common/vim/default.nix @@ -32,6 +32,8 @@ in { }; config = mkIf cfg.enable { + hm.stylix.targets.vim.enable = false; + environment = with config.programs.vim; { systemPackages = [package]; variables = rec { diff --git a/modules/common/vscode.nix b/modules/common/vscode.nix index 10d4bf6..0780b0b 100644 --- a/modules/common/vscode.nix +++ b/modules/common/vscode.nix @@ -69,30 +69,19 @@ in { ] ++ optional cfg.vim.enable vscodevim.vim; - userSettings = let - font = config.fontScheme.monospaceFont; - fontFamily = font.family; - fontSize = font.size; - in { - editor = - { - inherit fontFamily fontSize; - inlayHints = {inherit fontFamily fontSize;}; - codeLens = false; - cursorStyle = "block"; - detectIndentation = true; - minimap.enabled = false; - renderWhitespace = "trailing"; - rulers = [80 120]; - smoothScrolling = false; - tabCompletion = "on"; - } - // (let - surround = 10; - in { - cursorSurroundingLines = surround; - scrollBeyondLastColumn = surround; - }); + userSettings = { + editor = { + codeLens = false; + cursorStyle = "block"; + detectIndentation = true; + minimap.enabled = false; + renderWhitespace = "trailing"; + rulers = [80 120]; + smoothScrolling = false; + tabCompletion = "on"; + cursorSurroundingLines = 10; + scrollBeyondLastColumn = 10; + }; keyboard.dispatch = "keyCode"; @@ -117,13 +106,6 @@ in { }; }; - debug.console = {inherit fontFamily fontSize;}; - - scm = { - inputFontFamily = fontFamily; - inputFontSize = fontSize; - }; - extensions = { autoCheckUpdates = false; autoUpdate = false; @@ -131,7 +113,6 @@ in { }; terminal.integrated = { - inherit fontFamily fontSize; enableBell = true; }; @@ -225,8 +206,6 @@ in { vim = mkIf cfg.vim.enable { easymotion = true; - easymotionMarkerFontFamily = fontFamily; - easymotionMarkerFontSize = fontSize; leader = " "; diff --git a/modules/common/zathura.nix b/modules/common/zathura.nix index f78a9e9..b13d2a6 100644 --- a/modules/common/zathura.nix +++ b/modules/common/zathura.nix @@ -10,111 +10,74 @@ in { mkEnableOption "Zathura PDF reader"; config = mkIf cfg.enable { - hm.programs.zathura = with config.nixfiles.modules; { + hm.programs.zathura = { enable = true; - options = - (with config.colourScheme; { - default-fg = white; - default-bg = black; + options = { + recolor = true; + recolor-keephue = false; + recolor-reverse-video = false; - statusbar-fg = black; - statusbar-bg = white; + highlight-transparency = "0.3"; - inputbar-fg = black; - inputbar-bg = brightGreen; + n-completion-items = 10; - notification-fg = black; - notification-bg = brightBlue; + guioptions = ""; - notification-warning-fg = black; - notification-warning-bg = brightYellow; + statusbar-basename = true; + statusbar-home-tilde = true; - notification-error-fg = black; - notification-error-bg = brightRed; + statusbar-h-padding = 0; + statusbar-v-padding = 0; - highlight-color = brightYellow; - highlight-active-color = yellow; + window-height = 800; + window-width = 600; - completion-fg = brightWhite; - completion-bg = brightBlack; + window-icon = ""; - completion-highlight-fg = black; - completion-highlight-bg = brightRed; + abort-clear-search = true; - completion-group-fg = black; - completion-group-bg = brightRed; + incremental-search = true; - recolor-darkcolor = black; - recolor-lightcolor = white; - }) - // { - recolor = true; - recolor-keephue = false; - recolor-reverse-video = false; + adjust-open = "best-fit"; - highlight-transparency = "0.3"; + advance-pages-per-row = false; - font = config.fontScheme.monospaceFont.family; + database = "sqlite"; - n-completion-items = 10; + dbus-service = false; - guioptions = ""; + page-padding = 0; - statusbar-basename = true; - statusbar-home-tilde = true; + pages-per-row = 1; - statusbar-h-padding = 0; - statusbar-v-padding = 0; + render-loading = false; - window-height = 800; - window-width = 600; + show-directories = true; + show-hidden = true; + show-recent = 10; - window-icon = ""; + link-zoom = true; + link-hadjust = true; - abort-clear-search = true; + window-title-basename = true; + window-title-home-tilde = true; + window-title-page = true; - incremental-search = true; + zoom-center = false; + zoom-max = 1000; + zoom-min = 10; + zoom-step = 10; - adjust-open = "best-fit"; + scroll-hstep = -1; + scroll-step = 40; + scroll-full-overlap = 0; + scroll-wrap = true; + scroll-page-aware = false; - advance-pages-per-row = false; - - database = "sqlite"; - - dbus-service = false; - - page-padding = 0; - - pages-per-row = 1; - - render-loading = false; - - show-directories = true; - show-hidden = true; - show-recent = 10; - - link-zoom = true; - link-hadjust = true; - - window-title-basename = true; - window-title-home-tilde = true; - window-title-page = true; - - zoom-center = false; - zoom-max = 1000; - zoom-min = 10; - zoom-step = 10; - - scroll-hstep = -1; - scroll-step = 40; - scroll-full-overlap = 0; - scroll-wrap = true; - scroll-page-aware = false; - - selection-clipboard = "clipboard"; - selection-notification = false; - }; + selection-clipboard = "clipboard"; + selection-notification = false; + }; }; }; } -- cgit 1.4.1