Configure kitty with home-manager

basically i’m trying to configure kitty with home-manager but the background_opacity option is not working

programs.kitty = {
    enable = true;
    background_opacity = 0.5;
    confirm_os_window_close = false;
  };

error:
… while evaluating a branch condition
at /nix/store/22r7q7s9552gn1vpjigkbhfgcvhsrz68-source/lib/lists.nix:125:9:
124| fold’ = n:
125| if n == len
| ^
126| then nul

   … while calling the 'length' builtin
     at /nix/store/22r7q7s9552gn1vpjigkbhfgcvhsrz68-source/lib/lists.nix:123:13:
      122|     let
      123|       len = length list;
         |             ^
      124|       fold' = n:

   (stack trace truncated; use '--show-trace' to show the full, detailed trace)

   error: The option `programs.kitty.background_opacity' does not exist. Definition values:
   - In `/nix/store/4l2s52hmk48dnf0fhyj4rkji4mmqi6kl-source/home.nix': 0.5

anyone knows how can i configure that correctly?

As the error message says, programs.kitty.background_opacity is not a Home Manager option (it doesn’t appear in this list). You can probably add it to programs.kitty.extraConfig, which is. Something like:

programs.kitty = {
  enable = true;
  extraConfig = ''
    background_opacity 0.5
    confirm_os_window_close -1
  '';
};
3 Likes

Alternative is to use programs.kitty.settings (reference)

programs.kitty = {
    enable = true;
+   settings = {
    background_opacity = 0.5;
    confirm_os_window_close = false;
+   };
  };

You might also need to enclose 0.5 in quotes to make it a string, but I am not 100% sure about this.

2 Likes