-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
76 lines (63 loc) · 1.53 KB
/
default.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
lib,
stdenv,
buildElispPackage,
elispInputs,
emacs-all-the-icons-fonts,
treesit-grammars,
iosevka-bin,
ripgrep,
xorg,
}:
let
init = buildElispPackage {
ename = "config-init";
src = lib.sourceByRegex ./. [ "init.org" ];
files = [ "init.org" ];
lispFiles = [
"early-init.el"
"init.el"
];
inherit elispInputs;
nativeCompileAhead = true;
wantExtraOutputs = false;
errorOnWarn = true;
doTangle = false;
preBuild = ''
export HOME="$NIX_BUILD_TOP/.home"
mkdir -p "$HOME/.config/emacs"
emacs --batch --quick \
--load org \
*.org \
--funcall org-babel-tangle
rm *.org
ln -s ${treesit-grammars}/lib "$HOME/.config/emacs/tree-sitter"
'';
meta = { };
};
in
stdenv.mkDerivation {
name = "emacs-config";
src = lib.sourceByRegex ./. [ "templates" ];
dontUnpack = true;
buildInputs = [
(iosevka-bin.override { variant = "Aile"; })
(iosevka-bin.override { variant = "CurlySlab"; })
(iosevka-bin.override { variant = "Etoile"; })
emacs-all-the-icons-fonts
ripgrep
];
passthru.components = {
inherit init;
};
installPhase = ''
mkdir -p $out
${xorg.lndir}/bin/lndir -silent ${init}/share/emacs/site-lisp $out
if [ -d "${init}/share/emacs/native-lisp" ]; then
mkdir -p $out/eln-cache
${xorg.lndir}/bin/lndir -silent ${init}/share/emacs/native-lisp $out/eln-cache
fi
install -D -t $out $src/templates
ln -s ${treesit-grammars}/lib $out/tree-sitter
'';
}