feat: add foot and clean up config

This commit is contained in:
2026-04-27 15:27:27 +02:00
parent 8b31e1ca9f
commit bac6e4997b
8 changed files with 149 additions and 91 deletions
+122 -41
View File
@@ -1,24 +1,66 @@
{ config, ... }:
let
repo = config.repo;
repoHelpers = repo.helpers;
in
{
flake.modules.nixos.terminfo =
{ pkgs, ... }:
let
terminalPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.terminal.packagePath;
mkPrimaryTerminalOption =
lib:
lib.mkOption {
type = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
};
command = lib.mkOption {
type = lib.types.str;
};
desktopId = lib.mkOption {
type = lib.types.str;
};
execArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
};
in
{
environment.systemPackages = [
terminalPackage.terminfo
];
};
flake.modules.homeManager.terminal =
mkPrimaryTerminal =
{
desktopId,
packageFor,
terminalModule,
}:
{ lib, pkgs, ... }:
let
package = packageFor pkgs;
in
{
imports = [ terminalModule ];
options.repo.terminal.primary = mkPrimaryTerminalOption lib;
config = {
repo.terminal.primary = {
inherit
desktopId
package
;
command = lib.getExe package;
execArgs = [ "-e" ];
};
xdg.terminal-exec = {
enable = true;
settings.default = [ desktopId ];
};
};
};
in
{
flake.modules.homeManager.terminal-foot =
{
lib,
pkgs,
@@ -27,38 +69,65 @@ in
let
repoTheme = repo.theme.kanagawa;
palette = repoTheme.palette;
terminalPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.terminal.packagePath;
};
terminalDesktopId = repo.desktop.terminal.desktopId;
hex = lib.removePrefix "#";
in
{
assertions = [
{
assertion = terminalPackage != null;
message = "Unknown terminal package `${lib.showAttrPath repo.desktop.terminal.packagePath}`.";
}
{
assertion = repo.desktop.terminal.command == "kitty";
message = "The terminal feature currently only supports kitty.";
}
{
assertion =
terminalPackage == null
|| terminalDesktopId == null
|| builtins.pathExists "${terminalPackage}/share/applications/${terminalDesktopId}";
message = "Terminal package `${lib.showAttrPath repo.desktop.terminal.packagePath}` must provide `${terminalDesktopId}`.";
}
];
xdg.terminal-exec = {
programs.foot = {
enable = true;
settings.default = lib.optional (terminalDesktopId != null) terminalDesktopId;
};
package = pkgs.foot;
settings = {
main = {
font = "JetBrains Mono:size=11:fontfeatures=-liga:fontfeatures=-calt";
pad = "3x3";
};
bell.system = "no";
scrollback.lines = 10000;
colors-dark = {
background = hex palette.background;
foreground = hex palette.foreground;
selection-background = hex palette.selectionBackground;
selection-foreground = hex palette.selectionForeground;
urls = hex palette.url;
cursor = "${hex palette.background} ${hex palette.cursor}";
regular0 = hex palette.terminal.color0;
regular1 = hex palette.terminal.color1;
regular2 = hex palette.terminal.color2;
regular3 = hex palette.terminal.color3;
regular4 = hex palette.terminal.color4;
regular5 = hex palette.terminal.color5;
regular6 = hex palette.terminal.color6;
regular7 = hex palette.terminal.color7;
bright0 = hex palette.terminal.color8;
bright1 = hex palette.terminal.color9;
bright2 = hex palette.terminal.color10;
bright3 = hex palette.terminal.color11;
bright4 = hex palette.terminal.color12;
bright5 = hex palette.terminal.color13;
bright6 = hex palette.terminal.color14;
bright7 = hex palette.terminal.color15;
"16" = hex palette.terminal.color16;
"17" = hex palette.terminal.color17;
};
};
};
};
flake.modules.homeManager.terminal-kitty =
{ pkgs, ... }:
let
repoTheme = repo.theme.kanagawa;
palette = repoTheme.palette;
in
{
programs.kitty = {
enable = true;
package = pkgs.kitty;
font = {
name = "JetBrains Mono";
size = 11;
@@ -112,4 +181,16 @@ in
'';
};
};
flake.modules.homeManager.primary-terminal-foot = mkPrimaryTerminal {
desktopId = "foot.desktop";
packageFor = pkgs: pkgs.foot;
terminalModule = config.flake.modules.homeManager.terminal-foot;
};
flake.modules.homeManager.primary-terminal-kitty = mkPrimaryTerminal {
desktopId = "kitty.desktop";
packageFor = pkgs: pkgs.kitty;
terminalModule = config.flake.modules.homeManager.terminal-kitty;
};
}