-
Notifications
You must be signed in to change notification settings - Fork 17
/
flake.nix
96 lines (79 loc) · 2.74 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
{
description = "Nightly custom Emacs builds for macOS";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
emacs-src = {
url = "github:emacs-mirror/emacs";
flake = false;
};
emacs-vterm-src = {
url = "github:akermu/emacs-libvterm";
flake = false;
};
};
outputs = { self, nixpkgs, emacs-src, emacs-vterm-src }:
let
supportedSystems = [ "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
overlays = [ self.overlay ];
});
in
{
packages = forAllSystems (system: {
emacs = nixpkgsFor.${system}.emacs;
emacs-vterm = nixpkgsFor.${system}.emacs-vterm;
});
overlay = final: prev: {
emacs-vterm = prev.stdenv.mkDerivation rec {
pname = "emacs-vterm";
version = "master";
src = emacs-vterm-src;
nativeBuildInputs = [
prev.cmake
prev.libtool
prev.glib.dev
];
buildInputs = [
prev.glib.out
prev.libvterm-neovim
prev.ncurses
];
cmakeFlags = [
"-DUSE_SYSTEM_LIBVTERM=yes"
];
preConfigure = ''
echo "include_directories(\"${prev.glib.out}/lib/glib-2.0/include\")" >> CMakeLists.txt
echo "include_directories(\"${prev.glib.dev}/include/glib-2.0\")" >> CMakeLists.txt
echo "include_directories(\"${prev.ncurses.dev}/include\")" >> CMakeLists.txt
echo "include_directories(\"${prev.libvterm-neovim}/include\")" >> CMakeLists.txt
'';
installPhase = ''
mkdir -p $out
cp ../vterm-module.so $out
cp ../vterm.el $out
'';
};
emacs = (prev.emacs.override { srcRepo = true; nativeComp = true; withXwidgets = true; withGTK3 = true; }).overrideAttrs (
o: rec {
version = "30.0.50";
src = emacs-src;
buildInputs = o.buildInputs ++ [ prev.darwin.apple_sdk.frameworks.WebKit ];
patches = [
./patches/fix-window-role.patch
];
postPatch = o.postPatch + ''
substituteInPlace lisp/loadup.el \
--replace '(emacs-repository-get-branch)' '"master"'
'';
postInstall = o.postInstall + ''
cp ${final.emacs-vterm}/vterm.el $out/share/emacs/site-lisp/vterm.el
cp ${final.emacs-vterm}/vterm-module.so $out/share/emacs/site-lisp/vterm-module.so
'';
CFLAGS = "-DMAC_OS_X_VERSION_MAX_ALLOWED=110203 -g -O2";
}
);
};
};
}