diff options
author | tv <tv@krebsco.de> | 2024-03-18 19:39:17 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2024-03-18 19:39:17 +0100 |
commit | b69c439bf4f700d92df8eb1c9ec5090bf50cc80c (patch) | |
tree | 202a50faa98c956a93842b1e784b18566e78d267 | |
parent | 859afaad63221ce5caa7a6859e53c9e6b89f9678 (diff) |
alacritty: move configs to /etc
-rw-r--r-- | configs/alacritty.nix | 95 | ||||
-rw-r--r-- | pkgs/simple/alacritty-tv.nix | 95 |
2 files changed, 99 insertions, 91 deletions
diff --git a/configs/alacritty.nix b/configs/alacritty.nix new file mode 100644 index 0000000..2d83aee --- /dev/null +++ b/configs/alacritty.nix @@ -0,0 +1,95 @@ +{ lib, config, pkgs, ... }: + +let + font-size = arg: { + program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; + args = [arg]; + }; + configs.default = lib.recursiveUpdate variants.${variant} { + bell.animation = "EaseOut"; + bell.duration = 50; + bell.color = "#ff00ff"; + colors.cursor.cursor = "#f042b0"; + colors.primary.background = "#202220"; + colors.primary.foreground = "#f0fff0"; + colors.normal.black = "#000000"; + colors.normal.red = "#cd0000"; + colors.normal.green = "#00cd00"; + colors.normal.yellow = "#bc7004"; + colors.normal.blue = "#4343be"; + colors.normal.magenta = "#cb06cb"; + colors.normal.cyan = "#04c9c9"; + colors.normal.white = "#bebebe"; + colors.bright.black = "#727272"; + colors.bright.red = "#fb6262"; + colors.bright.green = "#72fb72"; + colors.bright.yellow = "#fbfb72"; + colors.bright.blue = "#7272fb"; + colors.bright.magenta = "#fb53fb"; + colors.bright.cyan = "#72fbfb"; + colors.bright.white = "#fbfbfb"; + draw_bold_text_with_bright_colors = false; + hints.enabled = [ + { + regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; + mouse.enabled = true; + post_processing = true; + action = "Select"; + } + ]; + scrolling.multiplier = 8; + }; + configs.root = lib.recursiveUpdate configs.default { + colors.primary.background = "#230000"; + colors.primary.foreground = "#e0c0c0"; + colors.normal.black = "#800000"; + }; + configs.fzmenu = lib.recursiveUpdate configs.default { + colors.primary.background = "#2A172A"; + window.dimensions.columns = 70; + window.dimensions.lines = 9; + }; + variants.hidpi = { + font.normal.family = "iosevka tv 2 Light"; + font.italic.family = "iosevka tv 2 Light"; + font.bold.family = "iosevka tv 2 Medium"; + font.bold_italic.family = "iosevka tv 2 Medium"; + font.size = 5; + key_bindings = [ + { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } + { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } + { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } + ]; + }; + variants.x220 = { + font.normal.family = "Clean"; + font.bold.family = "Clean"; + font.bold.style = "Regular"; + font.size = 10; + key_bindings = [ + { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } + { key = "Up"; mods = "Control"; command = font-size "+1"; } + { key = "Down"; mods = "Control"; command = font-size "-1"; } + { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } + ]; + }; + variant = { + au = "hidpi"; + fu = "hidpi"; + leg = "hidpi"; + ru = "hidpi"; + }.${config.krebs.build.host.name} or "x220"; +in + +{ + environment.etc = + lib.mapAttrs' + (name: config: lib.nameValuePair "alacritty/${name}.json" { + source = pkgs.writeJSON "alacritty-${name}.json" config; + }) + configs; + + environment.systemPackages = [ + pkgs.alacritty-tv + ]; +} diff --git a/pkgs/simple/alacritty-tv.nix b/pkgs/simple/alacritty-tv.nix index e61b059..0e65434 100644 --- a/pkgs/simple/alacritty-tv.nix +++ b/pkgs/simple/alacritty-tv.nix @@ -1,91 +1,4 @@ -{ lib -, mylib -, pkgs -, variant ? "x220" -}: - -let - font-size = arg: { - program = "${pkgs.font-size-alacritty}/bin/font-size-alacritty"; - args = [arg]; - }; - configs.default = lib.recursiveUpdate variants.${variant} { - bell.animation = "EaseOut"; - bell.duration = 50; - bell.color = "#ff00ff"; - colors.cursor.cursor = "#f042b0"; - colors.primary.background = "#202220"; - colors.primary.foreground = "#f0fff0"; - colors.normal.black = "#000000"; - colors.normal.red = "#cd0000"; - colors.normal.green = "#00cd00"; - colors.normal.yellow = "#bc7004"; - colors.normal.blue = "#4343be"; - colors.normal.magenta = "#cb06cb"; - colors.normal.cyan = "#04c9c9"; - colors.normal.white = "#bebebe"; - colors.bright.black = "#727272"; - colors.bright.red = "#fb6262"; - colors.bright.green = "#72fb72"; - colors.bright.yellow = "#fbfb72"; - colors.bright.blue = "#7272fb"; - colors.bright.magenta = "#fb53fb"; - colors.bright.cyan = "#72fbfb"; - colors.bright.white = "#fbfbfb"; - draw_bold_text_with_bright_colors = false; - hints.enabled = [ - { - regex = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^\\u0000-\\u001F\\u007F-\\u009F<>\"\\s{-}\\^⟨⟩`]+"; - mouse.enabled = true; - post_processing = true; - action = "Select"; - } - ]; - scrolling.multiplier = 8; - }; - configs.root = lib.recursiveUpdate configs.default { - colors.primary.background = "#230000"; - colors.primary.foreground = "#e0c0c0"; - colors.normal.black = "#800000"; - }; - configs.fzmenu = lib.recursiveUpdate configs.default { - colors.primary.background = "#2A172A"; - window.dimensions.columns = 70; - window.dimensions.lines = 9; - }; - variants.hidpi = { - font.normal.family = "iosevka tv 2 Light"; - font.italic.family = "iosevka tv 2 Light"; - font.bold.family = "iosevka tv 2 Medium"; - font.bold_italic.family = "iosevka tv 2 Medium"; - font.size = 5; - key_bindings = [ - { key = "Up"; mods = "Control"; action = "IncreaseFontSize"; } - { key = "Down"; mods = "Control"; action = "DecreaseFontSize"; } - { key = "Down"; mods = "Shift|Control"; action = "ResetFontSize"; } - ]; - }; - variants.x220 = { - font.normal.family = "Clean"; - font.bold.family = "Clean"; - font.bold.style = "Regular"; - font.size = 10; - key_bindings = [ - { key = "Up"; mods = "Shift|Control"; command = font-size "=14"; } - { key = "Up"; mods = "Control"; command = font-size "+1"; } - { key = "Down"; mods = "Control"; command = font-size "-1"; } - { key = "Down"; mods = "Shift|Control"; command = font-size "=0"; } - ]; - }; - - alacritty-configs = - pkgs.write "alacritty-configs" - (lib.mapAttrs' - (name: config: lib.nameValuePair "/${name}.json" { - link = pkgs.writeJSON "alacritty-${name}.json" config; - }) - configs); -in +{ pkgs }: pkgs.symlinkJoin { name = "alacritty-tv"; @@ -94,7 +7,7 @@ pkgs.symlinkJoin { # usage: # alacritty [--profile=PROFILE] [--singleton] [ARGS...] # where - # PROFILE must have a corresponding file ${alacritty-configs}/PROFILE.json + # PROFILE must have a corresponding file /etc/alacritty/PROFILE.json set -efu @@ -105,12 +18,12 @@ pkgs.symlinkJoin { shift esac - config=${alacritty-configs}/$profile.json + config=/etc/alacritty/$profile.json if ! test -e "$config"; then echo "$0: warning: bad profile: $profile; using default instead" >&2 profile=default - config=${alacritty-configs}/default.json + config=/etc/alacritty/default.json fi case ''${1-} in |