dotfiles/modules/programs/ghostty.nix

36 lines
837 B
Nix

{ config
, lib
, pkgs
, inputs
, ...
}:
with lib;
let
cfg = config.my.programs.ghostty;
format = pkgs.formats.keyValue {
listsAsDuplicateKeys = true;
};
in
{
options.my.programs.ghostty.enable = mkEnableOption "Ghostty";
options.my.programs.ghostty.package = (mkPackageOption pkgs "Ghostty" { }) // {
inherit (inputs.ghostty.packages.${pkgs.system}) default;
};
options.my.programs.ghostty.settings = mkOption {
inherit (format) type;
description = ''
Configuration written to {file}`$XDG_CONFIG_HOME/ghostty/config`.
'';
default = { };
};
config = mkIf cfg.enable {
my.terminal.package = cfg.package;
home-manager.users.moritz = {
home.packages = [ cfg.package ];
xdg.configFile."ghostty/config".source = format.generate "ghostty-config" cfg.settings;
};
};
}