This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

tools.kitty: wrap kitty via KITTY_CONFIG_DIRECTORY

A --config wrapper breaks 'kitty +kitten icat' (nnn image preview): kitty
only recognises +kitten as argv[1], so it opened a terminal window trying
to exec a program called +kitten. Move the config into tools/ and inject
it via the environment instead.

+119 -102
+8 -102
2configs/kitty.nix
··· 1 - { pkgs, ... }: 1 + { self, pkgs, ... }: 2 2 let 3 - kitty-cfg = pkgs.writeText "kitty.conf" '' 4 - # Font configuration 5 - font_family IosevkaTerm Nerd Font 6 - bold_font IosevkaTerm Nerd Font Bold 7 - italic_font IosevkaTerm Nerd Font Italic 8 - bold_italic_font IosevkaTerm Nerd Font Bold Italic 9 - font_size 12 10 - 11 - # Window settings 12 - initial_window_width 80c 13 - initial_window_height 20c 14 - 15 - # Enable remote control for runtime theme switching 16 - allow_remote_control yes 17 - listen_on unix:/tmp/kitty-socket 18 - 19 - # Include theme colors from /var/theme/config 20 - include /var/theme/config/kitty-colors.conf 21 - 22 - # URL handling 23 - open_url_with /run/current-system/sw/bin/xdg-open 24 - detect_urls yes 25 - 26 - # Disable bell 27 - enable_audio_bell no 28 - 29 - # Don't reset the terminal on ctrl+shift+delete; it's too close to 30 - # shift+insert (paste) and the reset scrambles running programs. 31 - map ctrl+shift+delete no_op 32 - ''; 33 - 34 - kitty = pkgs.symlinkJoin { 35 - name = "kitty"; 36 - paths = [ 37 - (pkgs.writeDashBin "kitty" '' 38 - ${pkgs.kitty}/bin/kitty --config ${kitty-cfg} "$@" 39 - '') 40 - pkgs.kitty 41 - ]; 42 - }; 43 - 44 - # Light theme colors (Gruvbox Light) 45 - lightColors = '' 46 - foreground #3c3836 47 - background #f9f5d7 48 - 49 - cursor #3c3836 50 - cursor_text_color #f9f5d7 51 - 52 - # Normal colors 53 - color0 #fbf1c7 54 - color1 #cc241d 55 - color2 #98971a 56 - color3 #d79921 57 - color4 #458588 58 - color5 #b16286 59 - color6 #689d6a 60 - color7 #7c6f64 61 - 62 - # Bright colors 63 - color8 #928374 64 - color9 #9d0006 65 - color10 #79740e 66 - color11 #b57614 67 - color12 #076678 68 - color13 #8f3f71 69 - color14 #427b58 70 - color15 #3c3836 71 - ''; 72 - 73 - # Dark theme colors 74 - darkColors = '' 75 - foreground #ffffff 76 - background #000000 77 - 78 - cursor #ffffff 79 - cursor_text_color #F81CE5 80 - 81 - # Normal colors 82 - color0 #000000 83 - color1 #fe0100 84 - color2 #33ff00 85 - color3 #feff00 86 - color4 #0066ff 87 - color5 #cc00ff 88 - color6 #00ffff 89 - color7 #d0d0d0 90 - 91 - # Bright colors 92 - color8 #808080 93 - color9 #fe0100 94 - color10 #33ff00 95 - color11 #feff00 96 - color12 #0066ff 97 - color13 #cc00ff 98 - color14 #00ffff 99 - color15 #FFFFFF 100 - ''; 101 - 3 + kitty = self.packages.${pkgs.system}.kitty; 102 4 in 103 5 { 6 + # TODO: this plumbing should go away. Tools need a generic way to expose 7 + # their per-theme files (e.g. a `themes.<name>.<file>` passthru contract 8 + # that themes.nix collects into /etc/themes/<name>/) instead of every 9 + # 2configs/<tool>.nix hand-wiring environment.etc entries like this. 104 10 environment.etc = { 105 - "themes/light/kitty-colors.conf".text = lightColors; 106 - "themes/dark/kitty-colors.conf".text = darkColors; 11 + "themes/light/kitty-colors.conf".text = kitty.themes.light; 12 + "themes/dark/kitty-colors.conf".text = kitty.themes.dark; 107 13 }; 108 14 environment.systemPackages = [ kitty ]; 109 15 }
+111
tools/kitty/flake-module.nix
··· 1 + { inputs, ... }: 2 + { 3 + perSystem = 4 + { pkgs, ... }: 5 + let 6 + kittyConfig = '' 7 + # Font configuration 8 + font_family IosevkaTerm Nerd Font 9 + bold_font IosevkaTerm Nerd Font Bold 10 + italic_font IosevkaTerm Nerd Font Italic 11 + bold_italic_font IosevkaTerm Nerd Font Bold Italic 12 + font_size 12 13 + 14 + # Window settings 15 + initial_window_width 80c 16 + initial_window_height 20c 17 + 18 + # Enable remote control for runtime theme switching 19 + allow_remote_control yes 20 + listen_on unix:/tmp/kitty-socket 21 + 22 + # Include theme colors from /var/theme/config 23 + include /var/theme/config/kitty-colors.conf 24 + 25 + # URL handling 26 + open_url_with /run/current-system/sw/bin/xdg-open 27 + detect_urls yes 28 + 29 + # Disable bell 30 + enable_audio_bell no 31 + 32 + # Don't reset the terminal on ctrl+shift+delete; it's too close to 33 + # shift+insert (paste) and the reset scrambles running programs. 34 + map ctrl+shift+delete no_op 35 + ''; 36 + 37 + # kitty only recognises `+kitten` as its first argument, so the config 38 + # must not be injected via `--config`: that would turn `kitty +kitten 39 + # icat` (nnn's image preview) into a terminal window trying to exec a 40 + # program called `+kitten`. KITTY_CONFIG_DIRECTORY leaves argv alone. 41 + configDir = pkgs.writeTextDir "kitty.conf" kittyConfig; 42 + 43 + # Color files consumed by switch-theme (2configs/themes.nix) via 44 + # /etc/themes/<name>/kitty-colors.conf. 45 + themes = { 46 + # Gruvbox Light 47 + light = '' 48 + foreground #3c3836 49 + background #f9f5d7 50 + 51 + cursor #3c3836 52 + cursor_text_color #f9f5d7 53 + 54 + # Normal colors 55 + color0 #fbf1c7 56 + color1 #cc241d 57 + color2 #98971a 58 + color3 #d79921 59 + color4 #458588 60 + color5 #b16286 61 + color6 #689d6a 62 + color7 #7c6f64 63 + 64 + # Bright colors 65 + color8 #928374 66 + color9 #9d0006 67 + color10 #79740e 68 + color11 #b57614 69 + color12 #076678 70 + color13 #8f3f71 71 + color14 #427b58 72 + color15 #3c3836 73 + ''; 74 + dark = '' 75 + foreground #ffffff 76 + background #000000 77 + 78 + cursor #ffffff 79 + cursor_text_color #F81CE5 80 + 81 + # Normal colors 82 + color0 #000000 83 + color1 #fe0100 84 + color2 #33ff00 85 + color3 #feff00 86 + color4 #0066ff 87 + color5 #cc00ff 88 + color6 #00ffff 89 + color7 #d0d0d0 90 + 91 + # Bright colors 92 + color8 #808080 93 + color9 #fe0100 94 + color10 #33ff00 95 + color11 #feff00 96 + color12 #0066ff 97 + color13 #cc00ff 98 + color14 #00ffff 99 + color15 #FFFFFF 100 + ''; 101 + }; 102 + in 103 + { 104 + packages.kitty = inputs.wrappers.lib.wrapPackage { 105 + inherit pkgs; 106 + package = pkgs.kitty; 107 + env.KITTY_CONFIG_DIRECTORY = "${configDir}"; 108 + passthru = { inherit themes; }; 109 + }; 110 + }; 111 + }