diff --git a/modules/default.nix b/modules/default.nix index e6706a3e..2a9dc0a7 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./ghostty.nix ./kbdd.nix ./polybar-program.nix ./thermal-zone.nix diff --git a/modules/ghostty.nix b/modules/ghostty.nix new file mode 100644 index 00000000..4dccca17 --- /dev/null +++ b/modules/ghostty.nix @@ -0,0 +1,65 @@ +{ + pkgs, + config, + inputs, + lib, + ... +}: +let + cfg = config.programs.ghostty; + keyValueSettings = { + listsAsDuplicateKeys = true; + mkKeyValue = lib.generators.mkKeyValueDefault { } " = "; + }; + keyValue = pkgs.formats.keyValue keyValueSettings; +in +{ + options.programs.ghostty = { + enable = lib.mkEnableOption "Enable ghostty"; + package = lib.mkOption { + type = lib.types.package; + default = + let + ghosttyPkgs = builtins.getAttr pkgs.hostPlatform.system inputs.ghostty.packages; + in + ghosttyPkgs.ghostty; + defaultText = lib.literalExpression "pkgs.ghostty"; + description = '' + Ghostty package to install. + ''; + }; + settings = lib.mkOption { + inherit (keyValue) type; + default = + let + inherit (config.stylix) fonts opacity; + inherit (config.lib.stylix) scheme; + in + { + font-family = [ + fonts.monospace.name + fonts.emoji.name + ]; + font-size = fonts.sizes.terminal; + background-opacity = opacity.terminal; + theme = scheme.slug; + }; + example = lib.literalExpression '' + { + theme = "catppuccin-mocha"; + font-size = 10; + } + ''; + description = '' + Configuration written to {file}`$XDG_CONFIG_HOME/ghostty/config`. + See for more information. + ''; + }; + }; + config = lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; + xdg.configFile."ghostty/config" = lib.mkIf (cfg.settings != { }) { + source = keyValue.generate "ghostty-config" cfg.settings; + }; + }; +} diff --git a/profiles/gui/ghostty.nix b/profiles/gui/ghostty.nix index 6ebdec4a..815f09b1 100644 --- a/profiles/gui/ghostty.nix +++ b/profiles/gui/ghostty.nix @@ -1,28 +1,24 @@ { - pkgs, config, - inputs, lib, ... }: { - home.packages = - let - ghosttyPkgs = builtins.getAttr pkgs.hostPlatform.system inputs.ghostty.packages; - in - [ ghosttyPkgs.ghostty ]; - xdg.configFile."ghostty/config".text = - let - inherit (config.stylix) fonts opacity; - inherit (config.lib.stylix) scheme; - in - '' - font-family = ${fonts.monospace.name} - font-family = ${fonts.emoji.name} - font-size = ${toString fonts.sizes.terminal} - background-opacity = ${toString opacity.terminal} - gtk-titlebar = false - window-decoration = false - theme = ${scheme.slug} - ''; + programs.ghostty = { + enable = lib.mkDefault true; + settings = + let + inherit (config.stylix) fonts opacity; + inherit (config.lib.stylix) scheme; + in + { + font-family = [ + fonts.monospace.name + fonts.emoji.name + ]; + font-size = fonts.sizes.terminal; + background-opacity = opacity.terminal; + theme = scheme.slug; + }; + }; } diff --git a/profiles/pc.nix b/profiles/pc.nix index 8d478659..a755ef58 100644 --- a/profiles/pc.nix +++ b/profiles/pc.nix @@ -35,6 +35,8 @@ home.sessionVariables = { BROWSER = "firefox"; }; + programs.ghostty.enable = true; + stylix = { enable = true; targets.gtk.enable = false; diff --git a/profiles/t14.nix b/profiles/t14.nix index fb564d92..34b78b69 100644 --- a/profiles/t14.nix +++ b/profiles/t14.nix @@ -77,6 +77,12 @@ }; }; }; + ghostty = { + settings = { + gtk-titlebar = false; + window-decoration = false; + }; + }; }; services.screen-locker = { # enable = true; diff --git a/profiles/work-common.nix b/profiles/work-common.nix index dab3232e..2987ce6a 100644 --- a/profiles/work-common.nix +++ b/profiles/work-common.nix @@ -268,6 +268,12 @@ }; }; }; + ghostty = { + settings = { + gtk-titlebar = false; + with-decoration = false; + }; + }; git.includes = [ { condition = "gitdir:~/projektai/**";