-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemacs.nix
42 lines (42 loc) · 1.33 KB
/
emacs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ from-elisp, emacs-overlay, nixpkgs, system } : { is-nixos-module } :
let
pkgs = import nixpkgs {
inherit system;
overlays = [ emacs-overlay.overlays.default ];
};
outside-emacs = [
(pkgs.python3.withPackages (p: (with p; [
python-lsp-server
python-lsp-ruff
pylsp-mypy
])))
pkgs.nil
pkgs.rust-analyzer
];
org-tangle-elisp-blocks = (pkgs.callPackage ./org.nix {inherit pkgs from-elisp;}).org-tangle ({ language, flags } :
let is-elisp = (language == "emacs-lisp") || (language == "elisp");
is-tangle = if flags ? ":tangle" then
flags.":tangle" == "yes" || flags.":tangle" == "y" else false;
in is-elisp && is-tangle
);
config-el = pkgs.substituteAll {
name = "default.el";
isnixosmodule = if is-nixos-module then "t" else "nil";
src = pkgs.writeText "config.el" (org-tangle-elisp-blocks (builtins.readFile ./README.org));
};
in
(pkgs.emacsWithPackagesFromUsePackage {
package = pkgs.emacs-git.override { withGTK3 = true; };
config = config-el;
alwaysEnsure = true;
defaultInitFile = true;
extraEmacsPackages = epkgs: with epkgs; [
(treesit-grammars.with-grammars (g: with g; [
tree-sitter-rust
tree-sitter-python
]))
] ++ outside-emacs;
override = final: prev: {
final.buildInputs = prev.buildInputs ++ outside-emacs;
};
})