From 72bd0887b49853e65eb773bf760d2c7987b82193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Tue, 21 Oct 2025 16:01:55 +0200 Subject: [PATCH] Home Gen10 @ 2025-10-20-12:41 by admin-jroeger@T14-OE130-7-ubuntu --- modules/home/doom/doom.nix | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/modules/home/doom/doom.nix b/modules/home/doom/doom.nix index 267d83a..a8f326b 100644 --- a/modules/home/doom/doom.nix +++ b/modules/home/doom/doom.nix @@ -85,9 +85,21 @@ ${config.xdg.configHome}/doom-emacs/bin/doom "$@" fi ''; + doom-open = pkgs.writeShellScriptBin "doom-open" '' + if [ -t 0]; then + exec ${wrapped-emacs}/bin/emacsclient -t "$@" + else + exec ${wrapped-emacs}/bin/emacsclient -c "$@" + fi + ''; in { options.hive.doom = { enable = lib.mkEnableOption "Enable Doom Emacs"; + asDefaultEditor = lib.mkOption { + type = lib.types.bool; + default = false; + description = "set the EDITOR variable to use the current emacs server (graphical/non-graphical)"; + }; enableCopilot = lib.mkEnableOption "Enable Copilot in Doom Emacs"; enableTidal = lib.mkEnableOption "Enable TidalCycles"; withLatexPkgs = lib.mkEnableOption "Enable LaTeX packages in doom path"; @@ -146,10 +158,14 @@ in { home = { sessionPath = ["${config.xdg.configHome}/doom-emacs/bin"]; - sessionVariables = { - DOOMDIR = "${config.xdg.configHome}/doom-config"; - DOOMLOCALDIR = "${config.xdg.configHome}/doom-local"; - }; + sessionVariables = + { + DOOMDIR = "${config.xdg.configHome}/doom-config"; + DOOMLOCALDIR = "${config.xdg.configHome}/doom-local"; + } + // lib.optionalAttrs cfg.asDefaultEditor { + EDITOR = "${doom-open}"; + }; }; systemd.user.services.doom-emacs-server = {