From 2b9a8a4f3bc9acfec6ddce20d96d1436938a0c51 Mon Sep 17 00:00:00 2001 From: Bloxx12 Date: Thu, 3 Jul 2025 23:34:56 +0200 Subject: [PATCH] ghostty: fix config --- flake.lock | 92 +++++++++++++++++++++++-- flake.nix | 2 +- modules/programs/gui/ghostty/module.nix | 67 +++++++++++++----- 3 files changed, 137 insertions(+), 24 deletions(-) diff --git a/flake.lock b/flake.lock index 6ea4b48..29a9f70 100644 --- a/flake.lock +++ b/flake.lock @@ -272,6 +272,39 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flakey-profile": { + "locked": { + "lastModified": 1712898590, + "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", + "owner": "lf-", + "repo": "flakey-profile", + "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", + "type": "github" + }, + "original": { + "owner": "lf-", + "repo": "flakey-profile", + "type": "github" + } + }, "git-hooks-nix": { "inputs": { "flake-compat": "flake-compat", @@ -693,6 +726,41 @@ "type": "github" } }, + "lix": { + "flake": false, + "locked": { + "lastModified": 1751235704, + "narHash": "sha256-J4ycLoXHPsoBoQtEXFCelL4xlq5pT8U9tNWNKm43+YI=", + "rev": "1d7368585eebaa2c4bdbcb88fe600cfb2239b2c6", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/1d7368585eebaa2c4bdbcb88fe600cfb2239b2c6.tar.gz?rev=1d7368585eebaa2c4bdbcb88fe600cfb2239b2c6" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/lix/archive/release-2.93.tar.gz" + } + }, + "lix-module": { + "inputs": { + "flake-utils": "flake-utils", + "flakey-profile": "flakey-profile", + "lix": "lix", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751240025, + "narHash": "sha256-SXUAlxpjPRkArRMHy5+Hdi+PiC+ND9yzzIjiaHmTvQU=", + "rev": "8b1094356f4723d6e89d3f8a95b333ee16d9ab02", + "type": "tarball", + "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/8b1094356f4723d6e89d3f8a95b333ee16d9ab02.tar.gz?rev=8b1094356f4723d6e89d3f8a95b333ee16d9ab02" + }, + "original": { + "type": "tarball", + "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.2-1.tar.gz" + } + }, "nix": { "inputs": { "flake-parts": "flake-parts", @@ -708,12 +776,10 @@ "revCount": 21102, "type": "tarball", "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/nix-src/3.7.0/0197d1ca-253f-75ae-9f36-38c46bd107f4/source.tar.gz" - "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc.tar.gz?rev=cd2a9c028df820a83ca2807dc6c6e7abc3dfa7fc" }, "original": { "type": "tarball", "url": "https://flakehub.com/f/DeterminateSystems/nix-src/%2A" - "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz" } }, "nixpak": { @@ -907,11 +973,12 @@ "hyprland": "hyprland", "impermanence": "impermanence", "lanzaboote": "lanzaboote", + "lix-module": "lix-module", "nixpkgs": "nixpkgs_2", "quickshell": "quickshell", "rust-overlay": "rust-overlay_2", "schizofox": "schizofox", - "systems": "systems_2", + "systems": "systems_3", "watt": "watt" } }, @@ -964,7 +1031,7 @@ "nixpak": "nixpak", "nixpkgs": "nixpkgs_3", "searx-randomizer": "searx-randomizer", - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1744892989, @@ -1004,6 +1071,21 @@ } }, "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -1018,7 +1100,7 @@ "type": "github" } }, - "systems_2": { + "systems_3": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", diff --git a/flake.nix b/flake.nix index 4537be1..b574bc9 100644 --- a/flake.nix +++ b/flake.nix @@ -80,7 +80,7 @@ }; lix-module = { - url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz"; + url = "https://git.lix.systems/lix-project/nixos-module/archive/2.93.2-1.tar.gz"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/modules/programs/gui/ghostty/module.nix b/modules/programs/gui/ghostty/module.nix index 0a0a3e9..254f074 100644 --- a/modules/programs/gui/ghostty/module.nix +++ b/modules/programs/gui/ghostty/module.nix @@ -6,6 +6,8 @@ }: let inherit (lib.lists) elem; inherit (lib.meta) getExe; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.strings) concatStringsSep; inherit (config.meta.mainUser.defaultShell) name package; inherit (config.modules.style.colorScheme) slug; @@ -17,30 +19,59 @@ then name else "none"; - ghostty-settings = pkgs.writeText "config" '' - font-family = JetBrainsMono Nerd Font Mono - window-padding-x = 8 - window-padding-y = 8 - background-opacity = 0.85 - gtk-single-instance = true - font-size = 14 - theme = ${slug} - resize-overlay-duration = 0s - cursor-style-blink = false - confirm-close-surface = false - copy-on-select = true - term = xterm-256color + ghostty-settings = { + font-family = "JetBrainsMonoNerdFont"; + font-family-bold = "JetBrainsMonoNerdFontBold"; + font-family-italic = "JetBrainsMonoNerdFontItalic"; + font-family-bold-italic = "JetBrainsMonoNerdFontBoldItalic"; + font-size = 14; - shell-integration = ${shell-integration} - command = ${getExe package} - ''; + window-padding-x = 8; + window-padding-y = 8; + background-opacity = 0.85; + gtk-single-instance = "true"; + gtk-tabs-location = "bottom"; + gtk-wide-tabs = false; + window-padding-balance = true; + window-decoration = "none"; + theme = slug; + resize-overlay-duration = "0s"; + cursor-style-blink = "false"; + confirm-close-surface = "false"; + mouse-hide-while-typing = "true"; + window-theme = "ghostty"; + bold-is-bright = "true"; + term = "xterm-256color"; + + app-notifications = "no-clipboard-copy"; + shell-integration-features = "cursor,sudo,no-title"; + # window-padding-y = 10; + cursor-style = "block"; + + # Whether to automatically copy selected text to the clipboard. true will prefer to copy to the selection clipboard, otherwise it will copy to the system clipboard. + # The value clipboard will always copy text to the selection clipboard as well as the system clipboard. + copy-on-select = "clipboard"; + + shell-integration = shell-integration; + command = getExe package; + }; + + settingsFile = pkgs.writeText "config" <| concatStringsSep "\n" <| mapAttrsToList (name: value: "${name} = ${toString value}") ghostty-settings; + + ghostty = pkgs.ghostty.overrideAttrs (_: { + preBuild = '' + shopt -s globstar + sed -i 's/^const xev = @import("xev");$/const xev = @import("xev").Epoll;/' **/*.zig + shopt -u globstar + ''; + }); ghostty-wrapped = pkgs.symlinkJoin { name = "ghostty-wrapped"; - paths = [pkgs.ghostty]; + paths = [ghostty]; nativeBuildInputs = [pkgs.makeWrapper]; postBuild = '' - wrapProgram $out/bin/ghostty --add-flags "--config-file=${ghostty-settings}" + wrapProgram $out/bin/ghostty --add-flags "--config-file=${settingsFile}" ''; }; in {