libkookie: kitty: adding module and configuration

wip/yesman
Katharina Fey 3 years ago
parent 141a837d25
commit 76f3d25f0c
  1. 18
      infra/libkookie/configuration/workstation/kitty/default.nix
  2. 24
      infra/libkookie/modules/workstation/ui/kitty/config.nix
  3. 108
      infra/libkookie/modules/workstation/ui/kitty/default.nix
  4. 12
      infra/libkookie/modules/workstation/ui/kitty/setup.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 = [ <modules/workstation/ui/kitty/default.nix> ];
# Customise kitty installation
libkookie.ui.kitty.enable = true;
}

@ -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}
''

@ -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);
}

@ -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; };
}
Loading…
Cancel
Save