tvl-depot/users/sterni/emacs/default.nix
sterni ebba8105bc feat(sterni/emacs): install CMake mode
Change-Id: Ia48809cd0a8de9b2d7f93b83976d97df08081cb9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5539
Reviewed-by: sterni <sternenseemann@systemli.org>
Autosubmit: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2022-05-09 13:52:13 +00:00

78 lines
2.2 KiB
Nix

{ depot, pkgs, ... }:
let
inherit (pkgs.emacsNativeComp.pkgs) withPackages;
emacs = withPackages (epkgs: [
epkgs.bqn-mode
epkgs.elpaPackages.ada-mode
epkgs.elpaPackages.rainbow-mode
epkgs.elpaPackages.undo-tree
epkgs.melpaPackages.adoc-mode
epkgs.melpaPackages.cmake-mode
epkgs.melpaPackages.direnv
epkgs.melpaPackages.dockerfile-mode
epkgs.melpaPackages.elfeed
epkgs.melpaPackages.evil
epkgs.melpaPackages.evil-collection
epkgs.melpaPackages.haskell-mode
epkgs.melpaPackages.hl-todo
epkgs.melpaPackages.jq-mode
epkgs.melpaPackages.languagetool
epkgs.melpaPackages.lsp-haskell
epkgs.melpaPackages.lsp-mode
epkgs.melpaPackages.magit
epkgs.melpaPackages.markdown-mode
epkgs.melpaPackages.meson-mode
epkgs.melpaPackages.nix-mode
epkgs.melpaPackages.paredit
epkgs.melpaPackages.rainbow-delimiters
epkgs.melpaPackages.sly
epkgs.melpaPackages.use-package
epkgs.melpaPackages.yaml-mode
epkgs.rust-mode
epkgs.tvlPackages.tvl
epkgs.urweb-mode
]);
configDirectory = pkgs.symlinkJoin {
name = "emacs.d";
paths = [
./.
(pkgs.writeTextFile {
name = "injected-emacs.d";
destination = "/nix-inject.el";
text = ''
;; bqn-mode
(setq bqn-interpreter-path "${pkgs.cbqn}/bin/BQN")
;; languagetool
(setq languagetool-java-bin "${pkgs.jre}/bin/java"
languagetool-console-command "${pkgs.languagetool}/share/languagetool-commandline.jar"
languagetool-server-command "${pkgs.languagetool}/share/languagetool-server.jar"
languagetool-java-arguments '("-Dfile.encoding=UTF-8"))
(provide 'nix-inject)
'';
})
];
postBuild = ''
rm "$out/default.nix"
'';
};
in
# sadly we can't give an init-file via the command line
(pkgs.writeShellScriptBin "emacs" ''
exec ${emacs}/bin/emacs \
--no-init-file \
--directory ${configDirectory} \
--eval "(require 'init)" \
"$@"
'').overrideAttrs (super: {
buildCommand = ''
${super.buildCommand}
ln -s "${emacs}/bin/emacsclient" "$out/bin/emacsclient"
'';
})