refactor(treewide): clean-up, flatten, rework module system

This commit is contained in:
ooks-io 2024-06-05 22:56:07 +12:00
parent 4ddf9d2b35
commit 5590c8a951
58 changed files with 397 additions and 635 deletions

View file

@ -1,43 +1,6 @@
{ lib, config, ... }:
let
cfg = config.ooknet.desktop.terminal;
in
{
imports = [
./foot
./kitty
./foot.nix
./kitty.nix
];
options.ooknet.desktop.terminal = {
foot = {
enable = lib.mkEnableOption "Enable foot terminal";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set foot as default terminal in environment variables";
};
};
kitty = {
enable = lib.mkEnableOption "Enable kitty terminal";
default = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Set kitty as default terminal in environment variables";
};
};
};
config = {
assertions = [
{
assertion =
(lib.length (lib.filter (x: x) [
cfg.foot.default or false
cfg.kitty.default or false
]) <= 1);
message = "Only one terminal can be default in the configuration";
}
];
};
}

View file

@ -2,16 +2,22 @@
let
inherit (config.colorscheme) palette;
fonts = config.ooknet.theme.fonts;
inherit (lib) mkIf;
fonts = config.ooknet.fonts;
cfg = config.ooknet.desktop.terminal.foot;
terminal = config.ooknet.desktop.terminal;
in
{
config = lib.mkIf cfg.enable {
home.sessionVariables = lib.mkIf cfg.default {
config = mkIf (cfg.enable || terminal == "foot") {
home.sessionVariables = mkIf (terminal == "foot") {
TERMINAL = "foot";
TERM = "foot";
};
ooknet.binds.terminal = mkIf (terminal == "foot") "foot";
ooknet.binds.terminalLaunch = mkIf (terminal == "foot") "foot";
programs.foot = {
enable = true;
server.enable = true;
@ -38,6 +44,7 @@ in
style = "beam";
blink = "yes";
};
colors = {
alpha = 1.0;
foreground = "${palette.base05}";

View file

@ -1,25 +1,32 @@
{ config, lib, ... }:
{ config, lib, osConfig, ... }:
let
inherit (lib) mkIf;
inherit (config.colorscheme) palette;
fonts = config.ooknet.theme.font;
cfg = config.ooknet.desktop.terminal.kitty;
fish = config.ooknet.console.shell.fish;
fonts = config.ooknet.fonts;
cfg = config.ooknet.terminal.kitty;
terminal = config.ooknet.desktop.terminal;
shell = osConfig.ooknet.host.admin.shell;
in
{
config = lib.mkIf cfg.enable {
home.sessionVariables = lib.mkIf cfg.default {
{
config = mkIf (cfg.enable || terminal == "kitty") {
home.sessionVariables = mkIf (terminal == "kitty") {
TERMINAL = "kitty -1";
TERM = "kitty -1";
};
ooknet.binds.terminal = mkIf (terminal == "kitty") "kitty -1";
ooknet.binds.terminalLaunch = mkIf (terminal == "kitty") "kitty -e";
programs.kitty = {
enable = true;
font = {
name = fonts.monospace.family;
size = 12;
};
shellIntegration.enableFishIntegration = lib.mkif fish.enable true;
shellIntegration.enableFishIntegration = mkIf (shell == "fish") true;
settings = {
scrollback_lines = 4000;
scrollback_pager_history_size = 2048;