Skip to content

Commit

Permalink
feat: add ghostty
Browse files Browse the repository at this point in the history
  • Loading branch information
konradmalik committed Dec 27, 2024
1 parent 583485f commit cc4b5c1
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 46 deletions.
208 changes: 168 additions & 40 deletions flake.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
};
nix-colors.url = "github:misterio77/nix-colors";

ghostty.url = "github:ghostty-org/ghostty";
neovim.url = "github:konradmalik/neovim-flake";

flake-parts.url = "github:hercules-ci/flake-parts";
Expand All @@ -45,10 +46,12 @@
extra-substituters = [
"https://konradmalik.cachix.org"
"https://nix-community.cachix.org"
"https://ghostty.cachix.org"
];
extra-trusted-public-keys = [
"konradmalik.cachix.org-1:9REXmCYRwPNL0kAB0IMeTxnMB1Gl9VY5I8w7UVBTtSI="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs"
"ghostty.cachix.org-1:QB389yTa6gTyneehvqG58y0WnHjQOqgnA+wBnpWWxns="
];
};

Expand Down
8 changes: 4 additions & 4 deletions home/konrad/common/options/alacritty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ in
description = "Font Family to use. If null, alacritty will set it automatically.";
};

package = lib.mkOption {
type = lib.types.nullOr lib.types.package;
package = mkOption {
type = types.nullOr types.package;
default = pkgs.alacritty;
description = "Package for alacritty. If null, it won't be installed.";
example = "pkgs.alacritty";
};

colorscheme = lib.mkOption {
type = lib.types.nullOr lib.types.attrs;
colorscheme = mkOption {
type = types.nullOr types.attrs;
default = config.colorscheme;
description = "Colorscheme attrset compatible with nix-colors format.";
example = "config.colorscheme";
Expand Down
1 change: 1 addition & 0 deletions home/konrad/common/options/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
alacritty = import ./alacritty;
bitwarden = import ./bitwarden.nix;
ghostty = import ./ghostty;
fonts = import ./fonts.nix;
monitors = import ./monitors.nix;
restic = import ./restic;
Expand Down
16 changes: 16 additions & 0 deletions home/konrad/common/options/ghostty/config.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
fontFamily,
fontSize,
theme,
}:
# it's not toml, but close enough for highlights
# toml
''
auto-update = off
gtk-single-instance = true
gtk-titlebar = false
font-family = ${fontFamily}
font-size = ${toString fontSize}
mouse-hide-while-typing = true
theme = ${theme}
''
63 changes: 63 additions & 0 deletions home/konrad/common/options/ghostty/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
config,
lib,
pkgs,
inputs,
...
}:
with lib;
let
cfg = config.konrad.programs.ghostty;
in
{
options.konrad.programs.ghostty = {
enable = mkEnableOption "Enables Ghostty configuration management through home-manager";

makeDefault = mkOption {
type = types.bool;
default = true;
description = "Whether to make this terminal default by setting TERMINAL env var";
};

fontSize = mkOption {
type = types.nullOr types.number;
default = config.fontProfiles.monospace.size;
example = "13.0";
description = "Font size. If null, ghostty will set it automatically.";
};

fontFamily = mkOption rec {
type = types.nullOr types.str;
default = config.fontProfiles.monospace.family;
example = default;
description = "Font Family to use. If null, ghostty will set it automatically.";
};

theme = mkOption {
type = types.nullOr types.str;
default = config.colorscheme.name;
example = "JetBrains Dracula";
description = "Theme to use. See 'ghosty +list-themes'";
};

package = mkOption {
type = types.nullOr types.package;
default = inputs.ghostty.packages.${pkgs.system}.default;
description = "Package for ghostty. If null, it won't be installed.";
example = "pkgs.ghostty";
};
};

config =
let
baseConfig = pkgs.callPackage ./config.nix { inherit (cfg) fontFamily fontSize theme; };
in
mkIf cfg.enable {
home = {
packages = lib.optional (cfg.package != null) cfg.package;
sessionVariables.TERMINAL = mkIf cfg.makeDefault "ghostty";
};

xdg.configFile."ghostty/config".text = baseConfig;
};
}
6 changes: 5 additions & 1 deletion home/konrad/m3800.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ in

fontProfiles.enable = true;
konrad.programs.bitwarden.enable = true;
konrad.programs.alacritty.enable = true;
konrad.programs.alacritty = {
makeDefault = false;
enable = true;
};
konrad.programs.ghostty.enable = true;
programs.neovim-pde = {
notesPath = mkOutOfStoreSymlink "${obsidianPath}/Personal";
spellPath = mkOutOfStoreSymlink "${config.home.homeDirectory}/Code/github.com/konradmalik/neovim-flake/files/spell";
Expand Down
8 changes: 7 additions & 1 deletion home/konrad/mbp13.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ in

fontProfiles = {
enable = true;
monospace.size = 16.0;
monospace.size = 15.0;
};
konrad.programs.bitwarden.enable = true;
konrad.programs.alacritty = {
makeDefault = false;
enable = true;
# installed via homebrew
package = null;
};
konrad.programs.ghostty = {
enable = true;
# installed via homebrew
package = null;
Expand Down
1 change: 1 addition & 0 deletions hosts/common/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"alacritty"
"calibre"
"firefox"
"ghostty"
"gimp"
"keepingyouawake"
"microsoft-auto-update"
Expand Down

0 comments on commit cc4b5c1

Please sign in to comment.