From bac6e4997bba77a29941a9aca123774b1332e9ce Mon Sep 17 00:00:00 2001 From: Jelle Spreeuwenberg Date: Mon, 27 Apr 2026 15:27:27 +0200 Subject: [PATCH] feat: add foot and clean up config --- modules/data.nix | 5 - modules/features/_noctalia-config.nix | 4 +- modules/features/niri/_bindings.nix | 5 +- modules/features/niri/default.nix | 22 ++-- modules/features/noctalia.nix | 35 ++---- modules/features/terminal.nix | 163 +++++++++++++++++++------- modules/features/workstation-base.nix | 3 +- modules/hosts/orion/default.nix | 3 +- 8 files changed, 149 insertions(+), 91 deletions(-) diff --git a/modules/data.nix b/modules/data.nix index 997a452..77b7ae3 100644 --- a/modules/data.nix +++ b/modules/data.nix @@ -35,11 +35,6 @@ packagePath = [ "nautilus" ]; }; - terminal = { - command = "kitty"; - desktopId = "kitty.desktop"; - packagePath = [ "kitty" ]; - }; }; services = { diff --git a/modules/features/_noctalia-config.nix b/modules/features/_noctalia-config.nix index 827db64..ed594d1 100644 --- a/modules/features/_noctalia-config.nix +++ b/modules/features/_noctalia-config.nix @@ -1,7 +1,7 @@ { homeDirectory, lib, - terminalPackage, + terminal, }: { settingsVersion = 53; @@ -260,7 +260,7 @@ pinnedApps = [ ]; useApp2Unit = false; sortByMostUsed = true; - terminalCommand = "${lib.getExe terminalPackage} -e"; + terminalCommand = lib.concatStringsSep " " ([ terminal.command ] ++ terminal.execArgs); customLaunchPrefixEnabled = false; customLaunchPrefix = ""; viewMode = "grid"; diff --git a/modules/features/niri/_bindings.nix b/modules/features/niri/_bindings.nix index 90725ca..9d69725 100644 --- a/modules/features/niri/_bindings.nix +++ b/modules/features/niri/_bindings.nix @@ -1,11 +1,10 @@ { browserCommand, - lib, - terminalPackage, + terminalCommand, }: { "Mod+Return" = { - action.spawn = "${lib.getExe terminalPackage}"; + action.spawn = terminalCommand; hotkey-overlay.title = "Terminal"; }; "Mod+B" = { diff --git a/modules/features/niri/default.nix b/modules/features/niri/default.nix index a9f6ee9..06de109 100644 --- a/modules/features/niri/default.nix +++ b/modules/features/niri/default.nix @@ -38,10 +38,7 @@ in inherit pkgs; path = repo.desktop.fileManager.packagePath; }; - terminalPackage = repoHelpers.resolvePackagePath { - inherit pkgs; - path = repo.desktop.terminal.packagePath; - }; + terminalCommand = config.repo.terminal.primary.command; outputs = lib.mapAttrs ( _: display: { @@ -160,17 +157,12 @@ in }; }; - binds = - if terminalPackage != null then - import ./_bindings.nix { - inherit - browserCommand - lib - ; - terminalPackage = terminalPackage; - } - else - { }; + binds = import ./_bindings.nix { + inherit + browserCommand + terminalCommand + ; + }; }; }; } diff --git a/modules/features/noctalia.nix b/modules/features/noctalia.nix index 387001a..22ff1c1 100644 --- a/modules/features/noctalia.nix +++ b/modules/features/noctalia.nix @@ -4,20 +4,17 @@ ... }: let - repo = config.repo; - repoHelpers = repo.helpers; - mkNoctaliaSettings = { homeDirectory, lib, - terminalPackage, + terminal, }: import ./_noctalia-config.nix { inherit homeDirectory lib - terminalPackage + terminal ; }; @@ -25,24 +22,15 @@ let { homeDirectory, lib, - pkgs, + terminal, }: - let - terminalPackage = repoHelpers.resolvePackagePath { - inherit pkgs; - path = repo.desktop.terminal.packagePath; - }; - in - if terminalPackage == null then - { } - else - mkNoctaliaSettings { - inherit - homeDirectory - lib - terminalPackage - ; - }; + mkNoctaliaSettings { + inherit + homeDirectory + lib + terminal + ; + }; mkPortableSettings = baseSettings: @@ -78,8 +66,9 @@ in }: let baseSettings = mkBaseSettings { - inherit lib pkgs; + inherit lib; homeDirectory = config.home.homeDirectory; + terminal = config.repo.terminal.primary; }; settings = if baseSettings == { } || !osConfig.meta.machine.portable then diff --git a/modules/features/terminal.nix b/modules/features/terminal.nix index 0fc0f15..d2d417d 100644 --- a/modules/features/terminal.nix +++ b/modules/features/terminal.nix @@ -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; + }; } diff --git a/modules/features/workstation-base.nix b/modules/features/workstation-base.nix index 58789e4..6bb1555 100644 --- a/modules/features/workstation-base.nix +++ b/modules/features/workstation-base.nix @@ -52,7 +52,8 @@ in homeModules.sops homeModules.git homeModules.ssh-client - homeModules.terminal + homeModules.primary-terminal-foot + homeModules.terminal-kitty homeModules.theme homeModules.vicinae homeModules.xdg diff --git a/modules/hosts/orion/default.nix b/modules/hosts/orion/default.nix index fcea6a8..07d4e82 100644 --- a/modules/hosts/orion/default.nix +++ b/modules/hosts/orion/default.nix @@ -21,7 +21,6 @@ in imports = [ nixosModules.host-base - nixosModules.terminfo nixosModules.sops-host-ssh-key nixosModules.openssh nixosModules.caddy @@ -35,6 +34,8 @@ in ./_disk.nix ]; + environment.enableAllTerminfo = true; + users.users.${account.name}.linger = true; }; }