mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-17 23:14:07 +01:00
feat: emacs daemon
This commit is contained in:
13
Justfile
13
Justfile
@@ -167,3 +167,16 @@ test-emacs:
|
||||
|
||||
test-emacs-clean:
|
||||
rm -rf $"($env.HOME)/.config/doom/"
|
||||
|
||||
emacs-plist-path := "~/Library/LaunchAgents/org.nix-community.home.emacs.plist"
|
||||
|
||||
reload-emacs-cmd := if os() == "macos" {
|
||||
"launchctl unload " + emacs-plist-path
|
||||
+ "\n"
|
||||
+ "launchctl load " + emacs-plist-path
|
||||
} else {
|
||||
"systemctl --user restart emacs.service"
|
||||
}
|
||||
|
||||
reload-emacs:
|
||||
{{reload-emacs-cmd}}
|
||||
|
||||
@@ -13,11 +13,6 @@
|
||||
- Emacs Wiki: <https://www.emacswiki.org/emacs/SiteMap>
|
||||
- Awesome Emacs: <https://github.com/emacs-tw/awesome-emacs#lsp-client>
|
||||
|
||||
Emacs daemon:
|
||||
|
||||
- <https://github.com/nix-community/home-manager/blob/master/modules/services/emacs.nix>
|
||||
- <https://github.com/LnL7/nix-darwin/blob/1a41453cba42a3a1af2fff003be455ddbd75386c/modules/services/emacs.nix>
|
||||
|
||||
## Install or Update
|
||||
|
||||
After deploying this nix flake, run the following command to install or update emacs:
|
||||
|
||||
@@ -19,9 +19,9 @@ with lib; let
|
||||
export PATH="${config.xdg.configHome}/emacs/bin:$PATH"
|
||||
'';
|
||||
shellAliases = {
|
||||
e = "emacs";
|
||||
ediff = ''emacs -nw --eval "(ediff-files \"$1\" \"$2\")"'';
|
||||
eman = ''emacs -nw --eval "(switch-to-buffer (man \"$1\"))"'';
|
||||
e = "emacsclient -c";
|
||||
ediff = ''emacsclient -c -nw --eval "(ediff-files \"$1\" \"$2\")"'';
|
||||
eman = ''emacsclient -c -nw --eval "(switch-to-buffer (man \"$1\"))"'';
|
||||
};
|
||||
in {
|
||||
options.modules.editors.emacs = {
|
||||
@@ -31,51 +31,82 @@ in {
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
## Emacs itself
|
||||
((emacsPackagesFor emacs-unstable-nox).emacsWithPackages
|
||||
(epkgs: [
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
librime
|
||||
emacs-all-the-icons-fonts
|
||||
|
||||
## Doom dependencies
|
||||
git
|
||||
(ripgrep.override {withPCRE2 = true;})
|
||||
gnutls # for TLS connectivity
|
||||
|
||||
## Optional dependencies
|
||||
fd # faster projectile indexing
|
||||
imagemagick # for image-dired
|
||||
zstd # for undo-fu-session/undo-tree compression
|
||||
|
||||
## Module dependencies
|
||||
# :checkers spell
|
||||
(aspellWithDicts (ds: with ds; [en en-computers en-science]))
|
||||
# :tools editorconfig
|
||||
editorconfig-core-c # per-project style config
|
||||
# :tools lookup & :lang org +roam
|
||||
sqlite
|
||||
# :lang latex & :lang org (latex previews)
|
||||
texlive.combined.scheme-medium
|
||||
];
|
||||
|
||||
programs.bash.bashrcExtra = envExtra;
|
||||
programs.zsh.envExtra = envExtra;
|
||||
home.shellAliases = shellAliases;
|
||||
programs.nushell.shellAliases = shellAliases;
|
||||
|
||||
# allow fontconfig to discover fonts and configurations installed through `home.packages`
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
xdg.configFile."doom".source = ./doom;
|
||||
|
||||
home.activation = mkIf cfg.doom.enable {
|
||||
installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
(mkIf pkgs.stdenv.isLinux {
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = with pkgs; ((emacsPackagesFor emacs-unstable-pgtk).emacsWithPackages (epkgs: [
|
||||
epkgs.vterm
|
||||
]))
|
||||
librime
|
||||
emacs-all-the-icons-fonts
|
||||
]));
|
||||
client.enable = true;
|
||||
startWithUserSession = true;
|
||||
};
|
||||
})
|
||||
|
||||
## Doom dependencies
|
||||
git
|
||||
(ripgrep.override {withPCRE2 = true;})
|
||||
gnutls # for TLS connectivity
|
||||
|
||||
## Optional dependencies
|
||||
fd # faster projectile indexing
|
||||
imagemagick # for image-dired
|
||||
zstd # for undo-fu-session/undo-tree compression
|
||||
|
||||
## Module dependencies
|
||||
# :checkers spell
|
||||
(aspellWithDicts (ds: with ds; [en en-computers en-science]))
|
||||
# :tools editorconfig
|
||||
editorconfig-core-c # per-project style config
|
||||
# :tools lookup & :lang org +roam
|
||||
sqlite
|
||||
# :lang latex & :lang org (latex previews)
|
||||
texlive.combined.scheme-medium
|
||||
];
|
||||
|
||||
programs.bash.bashrcExtra = envExtra;
|
||||
programs.zsh.envExtra = envExtra;
|
||||
home.shellAliases = shellAliases;
|
||||
programs.nushell.shellAliases = shellAliases;
|
||||
|
||||
# allow fontconfig to discover fonts and configurations installed through `home.packages`
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
xdg.configFile."doom".source = ./doom;
|
||||
|
||||
home.activation = mkIf cfg.doom.enable {
|
||||
installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
|
||||
'';
|
||||
};
|
||||
};
|
||||
(mkIf pkgs.stdenv.isDarwin {
|
||||
launchd.enable = true;
|
||||
launchd.agents.emacs = {
|
||||
enable = true;
|
||||
config = {
|
||||
ProgramArguments = with pkgs; let
|
||||
emacsPkg = (emacsPackagesFor emacs-unstable).emacsWithPackages (epkgs: [
|
||||
epkgs.vterm
|
||||
]);
|
||||
in [
|
||||
"${pkgs.bash}/bin/bash"
|
||||
"-l"
|
||||
"-c"
|
||||
"${emacsPkg}/bin/emacs --fg-daemon"
|
||||
];
|
||||
StandardErrorPath = "${config.home.homeDirectory}/Library/Logs/emacs-daemon.stderr.log";
|
||||
StandardOutPath = "${config.home.homeDirectory}/Library/Logs/emacs-daemon.stdout.log";
|
||||
RunAtLoad = true;
|
||||
KeepAlive = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
0
home/base/desktop/editors/emacs/doom/snippets/.keep
Normal file
0
home/base/desktop/editors/emacs/doom/snippets/.keep
Normal file
Reference in New Issue
Block a user