This repository has been archived by the owner on Aug 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
flake.nix
113 lines (102 loc) · 3.75 KB
/
flake.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{
outputs = { nixpkgs, emacs-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ emacs-overlay.overlay ];
};
inherit (pkgs.lib) attrsets;
emacs = pkgs.emacs-unstable.overrideAttrs (old: {
# Related: https://github.com/nix-community/emacs-overlay/issues/312#issuecomment-1554141967
passthru = old.passthru // { treeSitter = true; };
});
lib = import ./lib.nix { inherit pkgs emacs; };
emacsFromOverlay = pkgs.emacsWithPackagesFromUsePackage {
package = emacs;
config = ./init.el;
alwaysEnsure = false; # suppress warning
extraEmacsPackages = epkgs:
let
ensured = builtins.fromJSON (builtins.readFile ./ensured-packages.json);
extras = with epkgs; [
shut-up
treesit-grammars.with-all-grammars
];
in
extras ++ map (name: builtins.getAttr name epkgs) ensured;
override = final: prev: with lib.fetchers; {
eglot-x = fromGithub {
name = "eglot-x";
owner = "nemethf";
rev = "08cbd4369618e60576c95c194e63403f080328ba";
sha256 = "sha256-cWicqHYR/XU+71a8OFgF8vc6dmT/Fy0EEgzX0xvYiDc=";
buildInputs = [ final.eglot ];
};
hide-comnt = fromEmacsmirror {
name = "hide-comnt";
rev = "d1e94f5152f20b2dc7b0d42898c1db37e5be57a6";
sha256 = "002i9f97sq3jfknrw2nim1bhvj7xz3icviw7iffqmpmww4g1hq9l";
};
info-plus = fromEmacsmirror {
name = "info-plus";
rev = "4a6b93c170169594e1e8ea60cd799a1a88a969da";
sha256 = "1xzmx7m1qbl3b1x6yq1db1a108xqaa64ljfv1hdw763zmy4kc6m0";
};
};
};
pathExtras = with pkgs; lib.pkgsToPathString [
(aspellWithDicts (ps: [ ps.en ]))
graphviz-nox
multimarkdown
nixpkgs-fmt
plantuml
ripgrep
rustfmt
sqlite
# Language servers
marksman
nodePackages.bash-language-server
nodePackages.typescript-language-server
nodePackages.vscode-css-languageserver-bin
nodePackages.vscode-html-languageserver-bin
nodePackages.vscode-json-languageserver
rnix-lsp
rust-analyzer
terraform-ls
vscode-extensions.dbaeumer.vscode-eslint
vscode-extensions.graphql.vscode-graphql
yaml-language-server
];
package = with pkgs; symlinkJoin {
name = "emacs-wrapped";
buildInputs = [ makeWrapper ];
paths = [ emacsFromOverlay ];
postBuild = ''
for program in "$out/Applications/Emacs.app/Contents/MacOS/Emacs" "$out/bin/emacs"; do
if [ -f "$program" ]; then
wrapProgram "$program" \
--prefix PATH ":" "${pathExtras}" \
--set NIX_EMACS_DARWIN_PATH_EXTRAS "${pathExtras}:/opt/homebrew/bin" \
--set NIX_EMACS_SRC_DIR "${emacs}/share/emacs" \
--set NIX_EMACS_TEX_PROGRAM "${tectonic}/bin/tectonic" \
--set NIX_EMACS_NODE_PROGRAM "${nodejs}/bin/node"
fi
done
'';
};
in
rec {
packages.default = package;
apps.default = flake-utils.lib.mkApp {
drv = package;
exePath = "/bin/emacs";
};
overlays.default = final: prev: {
emacsCustom = package;
};
devShell = pkgs.mkShell {
buildInputs = [ package pkgs.gnumake ];
};
});
}