Hi all,
I’m trying out the kitty terminal emulator. I’m wondering how best to specify the config file. I’m not looking for a solution that e.g. populates $HOME
with dotfiles. I’m not looking for ways to have a Nix-y config either, just a way to specify the config file.
I care mostly about macOS, and I’d like the solution to work with the application bundle (kitty.app
) which I start via Spotlight.
Here’s my best attempt so far (requires nixpkgs#311655):
{ kitty, makeWrapper, lib }:
kitty.overrideAttrs (oldAttrs: {
installPhase =
let
oldWrapPrograms = lib.filter (lib.hasPrefix "wrapProgram") (lib.splitString "\n" oldAttrs.installPhase);
oldWrapProgram = (lib.elemAt oldWrapPrograms 0);
newWrapProgram = "${oldWrapProgram} --add-flags '--config ${./kitty.conf}'";
in
lib.replaceStrings [oldWrapProgram] [newWrapProgram] oldAttrs.installPhase;
})
This basically hijacks the wrapProgram
call in the installPhase
to add a --config
argument to the executable. This has two major drawbacks: (1) any config change requires a kitty rebuild and (2) it’s very brittle because it relies on specific behavior in the installPhase
.
Did I miss an obvious way of doing this without modifying the kitty
package in nixpkgs? Wrapping the derivation with symlinkJoin
and doing another wrapProgram
doesn’t work (wrapProgram
doesn’t seem to like being wrapped again) and e.g. updating the Info.plist
to add environment variables (KITTY_CONFIG_DIRECTORY
) with defaults
does not seem to work reliably (macOS doesn’t pick it up).
Suggestions welcome!