From 2f29ecd3e4c0ebf75f46647b4c4fb7261b978aac Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Mon, 22 Apr 2024 16:17:05 +0300 Subject: [PATCH] alacritty: replace base16-alacritty with a custom theme (#346) Replaces mustache template with a theme specified using Home Manager options. This removes the need for separate templates for TOML and YAML formats. The new colors better align with other terminal modules (e.g. wezterm), and base24 schemes with bright- mnemonics are now supported. Closes #341. --- flake.lock | 35 --------------------------- flake.nix | 10 -------- modules/alacritty/hm.nix | 51 +++++++++++++++++++++++++++++----------- stylix/templates.nix | 2 -- 4 files changed, 37 insertions(+), 61 deletions(-) diff --git a/flake.lock b/flake.lock index c389d3ed..10ec6aae 100644 --- a/flake.lock +++ b/flake.lock @@ -18,39 +18,6 @@ "type": "github" } }, - "base16-alacritty": { - "flake": false, - "locked": { - "lastModified": 1703982197, - "narHash": "sha256-TNxKbwdiUXGi4Z4chT72l3mt3GSvOcz6NZsUH8bQU/k=", - "owner": "aarowill", - "repo": "base16-alacritty", - "rev": "c95c200b3af739708455a03b5d185d3d2d263c6e", - "type": "github" - }, - "original": { - "owner": "aarowill", - "repo": "base16-alacritty", - "type": "github" - } - }, - "base16-alacritty-yaml": { - "flake": false, - "locked": { - "lastModified": 1674275109, - "narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=", - "owner": "aarowill", - "repo": "base16-alacritty", - "rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7", - "type": "github" - }, - "original": { - "owner": "aarowill", - "repo": "base16-alacritty", - "rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7", - "type": "github" - } - }, "base16-fish": { "flake": false, "locked": { @@ -235,8 +202,6 @@ "root": { "inputs": { "base16": "base16", - "base16-alacritty": "base16-alacritty", - "base16-alacritty-yaml": "base16-alacritty-yaml", "base16-fish": "base16-fish", "base16-foot": "base16-foot", "base16-helix": "base16-helix", diff --git a/flake.nix b/flake.nix index eefa1885..e8cd9f30 100644 --- a/flake.nix +++ b/flake.nix @@ -1,15 +1,5 @@ { inputs = { - base16-alacritty = { - flake = false; - url = "github:aarowill/base16-alacritty"; - }; - - base16-alacritty-yaml = { - flake = false; - url = "github:aarowill/base16-alacritty/63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7"; - }; - base16-fish = { flake = false; url = "github:tomyun/base16-fish"; diff --git a/modules/alacritty/hm.nix b/modules/alacritty/hm.nix index efab201d..dce85c13 100644 --- a/modules/alacritty/hm.nix +++ b/modules/alacritty/hm.nix @@ -1,23 +1,17 @@ -{pkgs, config, lib, ... }: - -with config.stylix.fonts; +# Documentation is available at: +# - https://alacritty.org/config-alacritty.html +# - `man 5 alacritty` +{ config, lib, ... }: let - useYaml = (builtins.compareVersions config.programs.alacritty.package.version "0.13.0") < 0; - templateRepo = config.lib.stylix.templates. - "base16-alacritty${if useYaml then "-yaml" else ""}"; - - themeFile = config.lib.stylix.colors { - inherit templateRepo; - }; + colors = config.lib.stylix.colors.withHashtag; in { - options.stylix.targets.alacritty.enable = - config.lib.stylix.mkEnableTarget "Alacritty" true; + options.stylix.targets.alacritty.enable = config.lib.stylix.mkEnableTarget "Alacritty" true; config = lib.mkIf config.stylix.targets.alacritty.enable { programs.alacritty.settings = { - font = { + font = with config.stylix.fonts; { normal = { family = monospace.name; style = "Regular"; @@ -25,7 +19,36 @@ in size = sizes.terminal; }; window.opacity = with config.stylix.opacity; terminal; - import = [ themeFile ]; + colors = with colors; { + primary = { + foreground = base05; + background = base00; + bright_foreground = base07; + }; + selection = { + text = base05; + background = base02; + }; + cursor = { + text = base00; + cursor = base05; + }; + normal = { + black = base00; + white = base05; + inherit red green yellow blue magenta cyan; + }; + bright = { + black = base03; + white = base07; + red = bright-red; + green = bright-green; + yellow = yellow; + blue = bright-blue; + magenta = bright-magenta; + cyan = bright-cyan; + }; + }; }; }; } diff --git a/stylix/templates.nix b/stylix/templates.nix index 65b54664..8b8b9b15 100644 --- a/stylix/templates.nix +++ b/stylix/templates.nix @@ -2,8 +2,6 @@ inputs: { config.lib.stylix.templates = { inherit (inputs) - base16-alacritty - base16-alacritty-yaml base16-fish base16-foot base16-helix