modules: init ghostty terminal

This commit is contained in:
Dmitriy Pleshevskiy 2025-01-02 19:49:47 +03:00
parent 2cfe35c4ac
commit 3f44674aae
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
7 changed files with 85 additions and 16 deletions
flake.lockflake.nix
hosts/home
modules/home-manager/programs/terminals
users/jan

24
flake.lock generated
View file

@ -178,11 +178,11 @@
]
},
"locked": {
"lastModified": 1727383923,
"narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=",
"lastModified": 1735774425,
"narHash": "sha256-C73gLFnEh8ZI0uDijUgCDWCd21T6I6tsaWgIBHcfAXg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ffe2d07e771580a005e675108212597e5b367d2d",
"rev": "5f6aa268e419d053c3d5025da740e390b12ac936",
"type": "github"
},
"original": {
@ -199,11 +199,11 @@
]
},
"locked": {
"lastModified": 1732466619,
"narHash": "sha256-T1e5oceypZu3Q8vzICjv1X/sGs9XfJRMW5OuXHgpB3c=",
"lastModified": 1735344290,
"narHash": "sha256-oJDtWPH1oJT34RJK1FSWjwX4qcGOBRkcNQPD0EbSfNM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f3111f62a23451114433888902a55cf0692b408d",
"rev": "613691f285dad87694c2ba1c9e6298d04736292d",
"type": "github"
},
"original": {
@ -342,11 +342,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1732617236,
"narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=",
"lastModified": 1735617354,
"narHash": "sha256-5zJyv66q68QZJZsXtmjDBazGnF0id593VSy+8eSckoo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e",
"rev": "69b9a8c860bdbb977adfa9c5e817ccb717884182",
"type": "github"
},
"original": {
@ -358,11 +358,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1732824227,
"narHash": "sha256-fYNXgpu1AEeLyd3fQt4Ym0tcVP7cdJ8wRoqJ+CtTRyY=",
"lastModified": 1735669367,
"narHash": "sha256-tfYRbFhMOnYaM4ippqqid3BaLOXoFNdImrfBfCp4zn0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c71ad5c34d51dcbda4c15f44ea4e4aa6bb6ac1e9",
"rev": "edf04b75c13c2ac0e54df5ec5c543e300f76f1c9",
"type": "github"
},
"original": {

View file

@ -168,6 +168,7 @@
./modules/home-manager
inputs.wired.homeManagerModules.default
inputs.lan-mouse.homeManagerModules.default
"${inputs.home-manager-unstable}/modules/programs/ghostty.nix"
];
}
];

View file

@ -58,7 +58,7 @@
services.ollama = {
enable = true;
package = pkgs.unstable.ollama;
package = pkgs.ollama;
acceleration = "rocm";
};

View file

@ -4,7 +4,7 @@
imports = [
./alacritty.nix
./foot.nix
./ghostty.nix
./wezterm.nix
];
}

View file

@ -0,0 +1,64 @@
{ lib, config, pkgs, ... }:
let
cfg = config.local.programs.terminals.ghostty;
themeCfg = config.local.themes."${config.local.theme.name}";
in
{
options.local.programs.terminals.ghostty = with lib; {
enable = mkEnableOption "ghostty";
package = mkPackageOption pkgs "ghostty" { };
fontSize = mkOption {
type = types.number;
default = 10.0;
description = "Ghostty font size";
};
};
config = lib.mkIf cfg.enable {
programs.ghostty = {
enable = true;
package = cfg.package;
settings = {
theme = "nixos-theme";
font-size = cfg.fontSize;
window-decoration = false;
cursor-style-blink = false;
shell-integration-features = "no-cursor";
};
enableZshIntegration = config.programs.zsh.enable;
themes = {
"nixos-theme" = {
palette = [
"0=${themeCfg.window.regular.color0}"
"1=${themeCfg.window.regular.color1}"
"2=${themeCfg.window.regular.color2}"
"3=${themeCfg.window.regular.color3}"
"4=${themeCfg.window.regular.color4}"
"5=${themeCfg.window.regular.color5}"
"6=${themeCfg.window.regular.color6}"
"7=${themeCfg.window.regular.color7}"
"8=${themeCfg.window.bold.color8}"
"9=${themeCfg.window.bold.color9}"
"10=${themeCfg.window.bold.color10}"
"11=${themeCfg.window.bold.color11}"
"12=${themeCfg.window.bold.color12}"
"13=${themeCfg.window.bold.color13}"
"14=${themeCfg.window.bold.color14}"
"15=${themeCfg.window.bold.color15}"
"16=${themeCfg.window.extended.color16}"
"17=${themeCfg.window.extended.color17}"
"18=${themeCfg.window.extended.color18}"
"19=${themeCfg.window.extended.color19}"
];
background = themeCfg.window.background;
foreground = themeCfg.window.mainText;
cursor-color = themeCfg.window.cursor;
cursor-text = themeCfg.window.cursorText;
selection-background = themeCfg.window.selection;
selection-foreground = themeCfg.window.selectionText;
};
};
};
};
}

View file

@ -18,7 +18,7 @@ in
programs.wezterm = {
enable = true;
colorSchemes = {
myCoolTheme = {
"nixos-theme" = {
ansi = [
themeCfg.window.regular.color0
themeCfg.window.regular.color1
@ -59,7 +59,7 @@ in
font = wezterm.font("monospace"),
font_size = ${toString cfg.fontSize},
front_end = "WebGpu",
color_scheme = "myCoolTheme",
color_scheme = "nixos-theme",
hide_tab_bar_if_only_one_tab = true,
-- https://github.com/wez/wezterm/issues/4483
enable_wayland = false,

View file

@ -84,6 +84,10 @@
################################################################################
local.programs.terminals = {
ghostty = {
enable = true;
package = pkgs.unstable.ghostty;
};
wezterm.enable = lib.mkDefault config.local.window-manager.xmonad.enable;
foot.enable = lib.mkDefault (!config.local.window-manager.xmonad.enable);
};