Enable emacs directly from nixfleet

This commit is contained in:
Andrea Ciceri 2024-10-30 14:51:53 +01:00
parent f81c7ce648
commit eae3b152d8
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
2 changed files with 968 additions and 1 deletions
hmModules/emacs

View file

@ -2,13 +2,18 @@
lib,
fleetFlake,
pkgs,
age,
...
}:
let
emacs = fleetFlake.packages.${pkgs.system}.emacs;
inherit (emacs.passthru) treesitGrammars;
in
{
home.sessionVariables.EDITOR = lib.mkForce "emacsclient -c";
systemd.user.sessionVariables = {
EDITOR = lib.mkForce "emacsclient -c";
OPENAI_API_KEY_PATH = age.secrets.chatgpt-token.path;
};
programs.emacs = {
enable = true;
package = emacs;
@ -46,4 +51,23 @@ in
en_US-large
it_IT
]);
home.activation = {
cloneCcrEmacsFlake = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
PATH=$PATH:${
lib.makeBinPath (
with pkgs;
[
git
openssh
]
)
}
if [ ! -d "$HOME/.config/emacs" ]; then
mkdir "$HOME/.config/emacs"
$DRY_RUN_CMD ln -s "$HOME/projects/aciceri/nixfleet/hmModules/emacs/init.el" "$HOME/.config/emacs/init.el"
$DRY_RUN_CMD ln -s "$HOME/.config/emacs" "$HOME/emacs"
fi
$DRY_RUN_CMD ln -sfn ${treesitGrammars} "$HOME/.config/emacs/tree-sitter"
'';
};
}