Files
nix/packages/devkit/ghostty.nix

50 lines
1.3 KiB
Nix

{
symlinkJoin,
makeWrapper,
pkgs,
lib,
ghostty ? pkgs.ghostty,
command ? null,
}: let
colors = import ./colors.nix;
theme = pkgs.writeText "theme" ''
palette = 0=${colors.base00}
palette = 1=${colors.base08}
palette = 2=${colors.base0B}
palette = 3=${colors.base0A}
palette = 4=${colors.base0D}
palette = 5=${colors.base0E}
palette = 6=${colors.base0C}
palette = 7=${colors.base05}
palette = 8=${colors.base03}
palette = 9=${colors.base08}
palette = 10=${colors.base0B}
palette = 11=${colors.base0A}
palette = 12=${colors.base0D}
palette = 13=${colors.base0E}
palette = 14=${colors.base0C}
palette = 15=${colors.base07}
background = ${colors.base00}
foreground = ${colors.base05}
cursor-color = ${colors.base05}
selection-background = ${colors.base02}
selection-foreground = ${colors.base07}
'';
in
symlinkJoin ({
paths = [ghostty];
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/ghostty \
--add-flags '--theme=${theme}' ${
if !(isNull command)
then "--add-flags '-e' --add-flags '${command}'"
else ""
}
'';
}
// {inherit (ghostty) name pname meta shell_integration terminfo;})