aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/modules
diff options
context:
space:
mode:
authorMx Kookie <kookie@spacekookie.de>2020-12-22 20:38:28 +0100
committerMx Kookie <kookie@spacekookie.de>2020-12-22 20:43:17 +0100
commit76f3d25f0c193a4e837632bd3d341ef7386c4193 (patch)
tree6aa5a2cc66219dd811b000d8cfe68444882fcdae /infra/libkookie/modules
parent141a837d25fad3b0ad90aff2ad993e815ed091b8 (diff)
libkookie: kitty: adding module and configuration
Diffstat (limited to 'infra/libkookie/modules')
-rw-r--r--infra/libkookie/modules/workstation/ui/kitty/config.nix24
-rw-r--r--infra/libkookie/modules/workstation/ui/kitty/default.nix108
-rw-r--r--infra/libkookie/modules/workstation/ui/kitty/setup.nix12
3 files changed, 144 insertions, 0 deletions
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 000000000000..a11b3d4cf26c
--- /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 000000000000..22a8cf8420cb
--- /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 000000000000..0783750bc69a
--- /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; };
+
+}