Skip to content

Commit bf013ee

Browse files
ghostty: add module
1 parent 35b98d2 commit bf013ee

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

modules/modules.nix

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
{ pkgs
1+
{ pkgs,
22

33
# Note, this should be "the standard library" + HM extensions.
4-
, lib
4+
lib,
55

66
# Whether to enable module type checking.
7-
, check ? true
7+
check ? true,
88

9-
# If disabled, the pkgs attribute passed to this function is used instead.
10-
, useNixpkgsModule ? true }:
9+
# If disabled, the pkgs attribute passed to this function is used instead.
10+
useNixpkgsModule ? true, }:
1111

1212
with lib;
1313

@@ -104,6 +104,7 @@ let
104104
./programs/getmail.nix
105105
./programs/gh.nix
106106
./programs/gh-dash.nix
107+
./programs/ghostty.nix
107108
./programs/git-cliff.nix
108109
./programs/git-credential-oauth.nix
109110
./programs/git.nix

modules/programs/ghostty.nix

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{ config, lib, pkgs, ... }:
2+
let
3+
cfg = config.programs.ghostty;
4+
keyValue = pkgs.formats.keyValue {
5+
mkKeyValue = lib.generators.mkKeyValueDefault { } " = ";
6+
};
7+
in {
8+
meta.maintainers = [ lib.maintainers.HeitorAugustoLN ];
9+
10+
options.programs.ghostty = {
11+
enable = lib.mkEnableOption "ghostty";
12+
package = lib.mkPackageOption pkgs "ghostty" { };
13+
14+
settings = lib.mkOption {
15+
inherit (keyValue) type;
16+
default = { };
17+
example = lib.literalExpression ''
18+
{
19+
theme = "catppuccin-mocha";
20+
font-size = 10;
21+
}
22+
'';
23+
description = ''
24+
Configuration written to $XDG_CONFIG_HOME/ghostty/config.
25+
26+
See https://ghostty.org/docs/config/reference for more information.
27+
'';
28+
};
29+
};
30+
31+
config = lib.mkIf cfg.enable {
32+
home.packages = [ cfg.package ];
33+
34+
xdg.configFile."ghostty/config" = lib.mkIf (cfg.settings != { }) {
35+
source = keyValue.generate "ghostty-config" cfg.settings;
36+
};
37+
};
38+
}

0 commit comments

Comments
 (0)