feat(devkit): ghostty wrapper

This commit is contained in:
Guz
2025-02-12 11:21:55 -03:00
parent cbed61b2f5
commit d3391bf182
4 changed files with 92 additions and 0 deletions

View File

@@ -116,5 +116,9 @@
devenv = ./modules/home-manager/devenv.nix; devenv = ./modules/home-manager/devenv.nix;
eww = ./modules/home-manager/eww.nix; eww = ./modules/home-manager/eww.nix;
}; };
packages = forAllSystems (pkgs: {
devkit = import ./packages/devkit {inherit pkgs;};
});
}; };
} }

View File

@@ -0,0 +1,18 @@
{
base00 = "#111111"; # base
base01 = "#101010"; # mantle
base02 = "#181818"; # surface0
base03 = "#181818"; # surface1
base04 = "#181818"; # surface2
base05 = "#cdd6f4"; # text
base06 = "#f5e0dc"; # rosewater
base07 = "#b4befe"; # lavender
base08 = "#f38ba8"; # red
base09 = "#fab387"; # peach
base0A = "#f9e2af"; # yellow
base0B = "#a6e3a1"; # green
base0C = "#94e2d5"; # teal
base0D = "#89b4fa"; # blue
base0E = "#cba6f7"; # mauve
base0F = "#f2cdcd"; # flamingo
}

View File

@@ -0,0 +1,3 @@
{pkgs}: rec {
ghostty = pkgs.callPackage ./ghostty {};
}

View File

@@ -0,0 +1,67 @@
{
symlinkJoin,
makeWrapper,
pkgs,
lib,
ghostty ? pkgs.ghostty,
paths ? [],
}: 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}
'';
drv = symlinkJoin ({
paths = ghostty;
nativeBuildInputs = [makeWrapper];
postBuild = ''
wrapProgram $out/bin/ghostty ${
if (builtins.length paths) > 0
then "$PATH:${lib.makeBinPath paths}"
else ""
} --add-flags '--theme=${theme}'
'';
}
// {inherit (ghostty) name pname meta;});
in
pkgs.stdenv.mkDerivation (rec {
name = drv.name;
pname = drv.pname;
buildCommand = let
desktopEntry = pkgs.makeDesktopItem {
name = pname;
desktopName = name;
exec = "${lib.getExe drv}";
};
in ''
mkdir -p $out/bin
cp ${lib.getExe drv} $out/bin
mkdir -p $out/share/applications
cp ${desktopEntry}/share/applications/${pname}.desktop $out/share/applications/${pname}.desktop
'';
}
// {inherit (ghostty) meta;})