diff --git a/infra/libkookie/configuration/workstation/kitty/default.nix b/infra/libkookie/configuration/workstation/kitty/default.nix new file mode 100644 index 00000000000..ff35dfeebf6 --- /dev/null +++ b/infra/libkookie/configuration/workstation/kitty/default.nix @@ -0,0 +1,18 @@ +/** + * The main configuration for kitty used on _all_ systems. + * + * The module is designed to use the default values I would like to + * use on my systems, however this will not stay this way, seeing as + * I plan on replacing it with the home-manager module in the future + * which will be tailored less to my use-case :) + */ + +{ config, home-manager, ... }: + +{ + # Load the home-manager kitty module + imports = [ ]; + + # Customise kitty installation + libkookie.ui.kitty.enable = true; +} diff --git a/infra/libkookie/modules/workstation/ui/kitty/config.nix b/infra/libkookie/modules/workstation/ui/kitty/config.nix new file mode 100644 index 00000000000..a11b3d4cf26 --- /dev/null +++ b/infra/libkookie/modules/workstation/ui/kitty/config.nix @@ -0,0 +1,24 @@ +{ config, lib, ... }: + +let + cfg = config.libkookie.ui.kitty; + colors = with lib; + (concatMapStringsSep "\n" (a: a) + (mapAttrsToList (k: v: "${k} ${v}") cfg.colors)); +in +'' + font_size 10 + + open_url_modifiers ctrl+shift + open_url_with default + + term ${cfg.term} + + cursor_shape ${cfg.cursorShape} + + background_opacity 0.85 + + enable_audio_bell no + + ${colors} +'' diff --git a/infra/libkookie/modules/workstation/ui/kitty/default.nix b/infra/libkookie/modules/workstation/ui/kitty/default.nix new file mode 100644 index 00000000000..22a8cf8420c --- /dev/null +++ b/infra/libkookie/modules/workstation/ui/kitty/default.nix @@ -0,0 +1,108 @@ +/** + * A home-manager configuration module for the kitty terminal + * + * TODO: This module should probably just be merged into the + * home-manager module, which does _most_ of this already. That way + * I won't have to maintain this personally :) + */ + +{ config, lib, pkgs, home-manager, ... } @ args: + +let cfg = config.libkookie.ui.kitty; +in +with lib; +{ + options.libkookie.ui.kitty = { + enable = mkEnableOption "kitty terminal configuration"; + + extraFonts = mkOption { + type = with types; listOf package; + default = [ pkgs.twemoji-color-font ]; + description = '' + Specify a set of extra fonts provided to the kitty configuration. + + By default ktty will use the standard monospace font specified + on your system (via the libkookie.fonts module), but to enable + emoji rendering (or ligatures?) you can specify additional + fonts here. + ''; + }; + + term = mkOption { + type = types.str; + default = "xterm-256color"; + description = '' + Specify what $TERM variable will be set. + + The default is chosen to allow backwards compatibility with + existing systems. You can set this varibale to `xterm-kitty` + to enable kitty specific features in applications. This may + cause problems with legacy applications and remote systems! + ''; + }; + + cursorShape = mkOption { + type = types.str; + default = "block"; + description = '' + Specify the shape of the cursor used for kitty. + ''; + }; + + colors = mkOption { + type = types.attrs; + default = { + selection_foreground = "#93a1a1"; + selection_background = "#073642"; + active_border_color = "#00ff00"; + inactive_border_color = "#cccccc"; + cursor = "#ffffff"; + + foreground = "#c5c8c6"; + background = "#1d1f21"; + + # black + color0 = "#1d1f21"; + color8 = "#969896"; + + # red + color1 = "#cc6666"; + color9 = "#cc6666"; + + # green + color2 = "#b5bd68"; + color10 = "#b5bd68"; + + # yellow + color3 = "#f0c674"; + color11 = "#f0c674"; + + # blue + color4 = "#81a2be"; + color12 = "#81a2be"; + + # magenta + color5 = "#b294bb"; + color13 = "#b294bb"; + + # cyan + color6 = "#8abeb7"; + color14 = "#8abeb7"; + + # white + color7 = "#c5c8c6"; + color15 = "#ffffff"; + }; + + description = '' + Specify the set of colours used to render text in the + terminal, as well as the standard foreground, background, + selection, and border colours. + + The default colours are based on the solarized dark theme. + ''; + }; + }; + + config = mkIf cfg.enable (import ./setup.nix args); +} diff --git a/infra/libkookie/modules/workstation/ui/kitty/setup.nix b/infra/libkookie/modules/workstation/ui/kitty/setup.nix new file mode 100644 index 00000000000..0783750bc69 --- /dev/null +++ b/infra/libkookie/modules/workstation/ui/kitty/setup.nix @@ -0,0 +1,12 @@ +{ config, lib, pkgs, home-manager, ... } @ args: + +let + cfg = config.libkookie.ui.kitty; + kittyConf = (import ./config.nix args); +in +{ + home.packages = [ pkgs.kitty ] ++ cfg.extraFonts; + + xdg.configFile."kitty/kitty.conf" = { text = kittyConf; }; + +}