emacs
This commit is contained in:
parent
8ced160207
commit
9bc13de0bd
3 changed files with 135 additions and 54 deletions
|
@ -1,67 +1,150 @@
|
|||
# Taken from: https://github.com/hlissner/dotfiles/blob/master/modules/editors/emacs.nix
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
}: let
|
||||
cfg = config.modules.editors.emacs;
|
||||
inherit (config.modules.other.system) username;
|
||||
repoUrl = inputs.doomemacs;
|
||||
configRepoUrl = inputs.doom-emacs-config;
|
||||
emacs-desktop-symbol = pkgs.makeDesktopItem {
|
||||
name = "emacsclient";
|
||||
desktopName = "Emacs Client";
|
||||
exec = "emacsclient -c -a emacs";
|
||||
};
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
|
||||
newpkgs =
|
||||
pkgs.appendOverlays
|
||||
(with inputs.emacs-overlay.overlays; [
|
||||
emacs
|
||||
package
|
||||
|
||||
(final: prev: {
|
||||
tree-sitter = prev.tree-sitter.override {
|
||||
extraGrammars = {
|
||||
tree-sitter-qmljs = {
|
||||
version = "master";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "yuja";
|
||||
repo = "tree-sitter-qmljs";
|
||||
rev = "35ead5b9955cdb29bcf709d622fa960ff33992b6";
|
||||
sha256 = "jT47lEGuk6YUjcHB0ZMyL3i5PqyUaCQmt0j78cUpy8Q=";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
||||
tree-sitter-parsers = grammars:
|
||||
with grammars; [
|
||||
tree-sitter-bash
|
||||
tree-sitter-c
|
||||
tree-sitter-c-sharp
|
||||
tree-sitter-cmake
|
||||
tree-sitter-cpp
|
||||
tree-sitter-css
|
||||
tree-sitter-dot
|
||||
tree-sitter-elisp
|
||||
tree-sitter-glsl
|
||||
tree-sitter-html
|
||||
tree-sitter-java
|
||||
tree-sitter-javascript
|
||||
tree-sitter-json
|
||||
tree-sitter-json5
|
||||
tree-sitter-kotlin
|
||||
tree-sitter-latex
|
||||
tree-sitter-llvm
|
||||
tree-sitter-lua
|
||||
tree-sitter-make
|
||||
tree-sitter-markdown
|
||||
tree-sitter-markdown-inline
|
||||
tree-sitter-nickel
|
||||
tree-sitter-nix
|
||||
tree-sitter-prisma
|
||||
tree-sitter-python
|
||||
tree-sitter-qmljs
|
||||
tree-sitter-regex
|
||||
tree-sitter-rust
|
||||
tree-sitter-scss
|
||||
tree-sitter-sql
|
||||
tree-sitter-toml
|
||||
tree-sitter-tsx
|
||||
tree-sitter-typescript
|
||||
tree-sitter-vim
|
||||
tree-sitter-yaml
|
||||
];
|
||||
|
||||
custom-emacs = with newpkgs; ((emacsPackagesFor (emacs29-pgtk.override {withNativeCompilation = true;})).emacsWithPackages (epkgs:
|
||||
with epkgs; let
|
||||
qml-ts-mode = trivialBuild {
|
||||
pname = "qml-ts-mode";
|
||||
version = "master";
|
||||
src = fetchFromGitHub {
|
||||
owner = "outfoxxed";
|
||||
repo = "qml-ts-mode";
|
||||
rev = "b24b9e78305ed045baa136782623ad16de01b7b8";
|
||||
sha256 = "PgXm/a92cX5zjA9blTrIRH7DfOUczRwb9oBcMMEzF2I=";
|
||||
};
|
||||
};
|
||||
in [
|
||||
all-the-icons
|
||||
all-the-icons-dired
|
||||
autorevert
|
||||
avy
|
||||
beacon
|
||||
#better-jumper
|
||||
company
|
||||
crux
|
||||
#cmake-font-lock
|
||||
direnv
|
||||
doom-modeline
|
||||
editorconfig
|
||||
evil
|
||||
evil-collection
|
||||
evil-goggles
|
||||
# face-explorer
|
||||
flycheck
|
||||
general
|
||||
# frames-only-mode
|
||||
# fussy
|
||||
# groovy-mode
|
||||
# just-mode
|
||||
kotlin-mode
|
||||
lsp-mode
|
||||
lsp-treemacs
|
||||
lsp-ui
|
||||
lsp-java
|
||||
magit
|
||||
markdown-mode
|
||||
nasm-mode
|
||||
nix-mode
|
||||
reformatter # required by nix mode
|
||||
projectile
|
||||
qml-ts-mode
|
||||
rainbow-mode
|
||||
string-inflection
|
||||
toc-org
|
||||
(treesit-grammars.with-grammars (grammars: tree-sitter-parsers grammars))
|
||||
treemacs
|
||||
treemacs-evil
|
||||
treemacs-projectile
|
||||
treemacs-magit
|
||||
undo-tree
|
||||
use-package
|
||||
vertico
|
||||
which-key
|
||||
wakatime-mode
|
||||
ws-butler
|
||||
]));
|
||||
in {
|
||||
options.modules.editors.emacs = {
|
||||
enable = mkEnableOption "emacs";
|
||||
doom.enable = mkEnableOption "doom";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
## Emacs itself as an overlay
|
||||
#nixpkgs.overlays = [inputs.emacs-overlay.overlay];
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacs29-pgtk;
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
binutils # native-comp needs 'as', provided by this
|
||||
emacs-desktop-symbol
|
||||
## Doom dependencies
|
||||
git
|
||||
ripgrep
|
||||
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 de]))
|
||||
# :tools editorconfig
|
||||
editorconfig-core-c # per-project style config
|
||||
# :tools lookup & :lang org +roam
|
||||
];
|
||||
|
||||
environment.variables.PATH = ["/home/vali/.config/emacs/bin"];
|
||||
|
||||
fonts.fonts = [pkgs.emacs-all-the-icons-fonts];
|
||||
|
||||
system.userActivationScripts = mkIf cfg.doom.enable {
|
||||
installDoomEmacs = ''
|
||||
#!/bin/bash
|
||||
if [ ! -d "/home/${username}/.config/emacs" ]; then
|
||||
git clone --depth=1 --single-branch "${repoUrl}" "/home/${username}/.config/emacs"
|
||||
git clone "${configRepoUrl}" "/home/${username}/.config/doom"
|
||||
fi
|
||||
'';
|
||||
home-manager.users.${username} = {
|
||||
home.packages = [custom-emacs];
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = custom-emacs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue