Major config overhaul: use custom modules, setup for multi-host config, and less boilerplate

This commit is contained in:
Emmet K
2025-02-09 16:50:26 -06:00
parent 1fa8b17b07
commit 0453901d17
303 changed files with 3560 additions and 5566 deletions

View File

@@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
let
editor = config.userSettings.editor;
term = config.userSettings.terminal;
in {
options = {
userSettings.editor = lib.mkOption {
default = "emacs";
description = "Default editor";
type = lib.types.enum [ "emacs" ];
# TODO add more editors
#type = lib.types.enum [ "emacs" "vim" "nvim" "neovide" "nano" "micro" "vscodium" "kate" "pulsar" ];
};
userSettings.spawnEditor = lib.mkOption {
default = "";
description = "Command to spawn editor";
};
};
config = {
userSettings.emacs.enable = lib.mkIf (config.userSettings.editor == "emacs") true;
userSettings.spawnEditor = lib.mkMerge [
(lib.mkIf (editor == "emacs") "emacsclient -c -a 'emacs'")
(lib.mkIf (editor == "neovide") "neovide -- --listen /tmp/nvimsocket")
(lib.mkIf (builtins.elem editor [ "vim" "nvim" "nano" "micro" ]) ("exec " + term + " -e " + editor))
(lib.mkIf (!(builtins.elem editor [ "emacs" "vim" "nvim" "neovide" "nano" "micro"])) editor)
];
};
}