{ config, pkgs, lib, ... }: let treeSitterLibraryExtension = if pkgs.stdenv.hostPlatform.isDarwin then "dylib" else "so"; treeSitterGrammars = { swift = pkgs.tree-sitter-grammars.tree-sitter-swift; python = pkgs.tree-sitter-grammars.tree-sitter-python; typescript = pkgs.tree-sitter-grammars.tree-sitter-typescript; tsx = pkgs.tree-sitter-grammars.tree-sitter-tsx; javascript = pkgs.tree-sitter-grammars.tree-sitter-javascript; json = pkgs.tree-sitter-grammars.tree-sitter-json; }; in { home.packages = with pkgs; [ enchant hunspell hunspellDicts.de_DE hunspellDicts.en_US ]; home.file = (lib.mapAttrs' (language: grammar: lib.nameValuePair ".emacs.d/tree-sitter/libtree-sitter-${language}.${treeSitterLibraryExtension}" { source = "${grammar}/parser"; }) treeSitterGrammars) // { ".emacs.d/early-init.el".source = ./config/early-init.el; ".emacs.d/snippets".source = ./config/snippets; }; programs.emacs = { enable = true; extraConfig = builtins.readFile ./config/init.el + builtins.readFile ./config/lisp/utils.el; extraPackages = epkgs: let myEpkgs = epkgs.overrideScope (import ./pkgs { inherit pkgs; }); in with myEpkgs; [ agent-shell apheleia avy cape cider clojure-mode consult consult-denote copilot corfu denote diff-hl dockerfile-mode ef-themes eglot envrc exec-path-from-shell flycheck flycheck-clj-kondo flycheck-swiftlint flymake-collection git-timemachine graphql-mode helpful htmlize jinx js2-mode json-mode ledger-mode ligature markdown-mode minions multiple-cursors nerd-icons nerd-icons-completion nerd-icons-corfu nerd-icons-dired nerd-icons-ibuffer ob-restclient ob-swift olivetti orderless org org-modern ox-gfm ox-reveal pulsar rainbow-delimiters rainbow-mode restclient smartparens swift-mode swift-ts-mode super-save terraform-mode treesit-auto ob-typescript yaml-mode vterm fontaine magit magit-todos marginalia modus-themes nix-mode vertico winpulse yasnippet ]; }; launchd.agents.emacs-server = { enable = true; config = { KeepAlive = true; ProgramArguments = [ "${config.programs.emacs.package}/bin/emacs" "--fg-daemon" ]; RunAtLoad = true; }; }; }