From 1957081c122fe231eb6120192489dd979d214317 Mon Sep 17 00:00:00 2001 From: mediocregopher Date: Sun, 13 Aug 2023 21:34:14 +0200 Subject: Update branch with all changes which could be brought in from private branches For a while I was keeping a private branch where there were a lot of non-public things included, and that became the de-facto branch while this one lagged. This one is now up-to-date, all private stuff is dealt with via config files which are not committed. --- alacritty/default.nix | 54 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 20 deletions(-) (limited to 'alacritty/default.nix') diff --git a/alacritty/default.nix b/alacritty/default.nix index c5681b0..213ec86 100644 --- a/alacritty/default.nix +++ b/alacritty/default.nix @@ -1,35 +1,49 @@ { - pkgs ? (import ../pkgs.nix) {}, + config, + + pkgs ? (import ../pkgs.nix).stable2305 {}, zsh ? pkgs.zsh, }: rec { - # TODO figure out a way to provide my font to alacritty at runtime. fontconfig - # is a hot mess... - # - #dataDir = pkgs.stdenv.mkDerivation { - # name = "alacritty-dataDir"; - # src = ./fonts; - # buildInputs = [ pkgs.fontconfig ]; - # builder = builtins.toFile "builder.sh" '' - # source $stdenv/setup - # mkdir "$out" - # cp -r "$src" "$out"/fonts - # chmod -R +w "$out" + defaultXDGOpenRules = [ + { + name = "open-url"; + pattern = "(ipfs:|ipns:|magnet:|mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)[^<>\"\\s{-}\\^⟨⟩`]+"; + xdgOpen = "$1"; + } + ]; - # env + xdgOpenRules = defaultXDGOpenRules ++ config.alacritty.xdgOpenRules; - # export FONTCONFIG_FILE="$out"/fontconfig - # fc-cache --verbose "$out"/fonts + hints = { + enabled = (builtins.map (r: + { + regex = r.pattern; + hyperlinks = true; + command = (pkgs.writeShellScript "alacritty-hints-${r.name}" '' + xdg-open "${r.xdgOpen}" + ''); + post_processing = true; + mouse.enabled = true; + } + ) xdgOpenRules); + }; - # ''; - #}; + configFile = pkgs.writeText "alacritty-config" ( + builtins.replaceStrings + ["$HINTS"] + [(builtins.toJSON hints)] + (builtins.readFile ./alacritty.yml) + ); alacritty = pkgs.writeScriptBin "alacritty" '' #!${pkgs.bash}/bin/bash - exec ${pkgs.nixgl}/bin/nixGLIntel ${pkgs.alacritty}/bin/alacritty \ - --config-file ${./alacritty.yml} \ + + exec ${pkgs.nixgl}/bin/nixGL ${pkgs.alacritty}/bin/alacritty \ + -o font.size=${builtins.toString config.alacritty.fontSize} \ + --config-file ${configFile} \ -e "${zsh}/bin/zsh" ''; } -- cgit v1.2.3