This repository was archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathemacs-overlay.nix
60 lines (51 loc) · 2.07 KB
/
emacs-overlay.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
let
pkgs = import ./pkgs.nix;
# I am using the "builder" from nix-community's emacs-overlay, with some slight modifications
# https://github.com/nix-community/emacs-overlay/blob/d1fbf6d39f3a0869c5fb0cc7f9ba7c9033e35cf9/default.nix#L25
mkGitEmacs = namePrefix: jsonFile: patches:
{ ... }@args:
let
repoMeta = pkgs.lib.importJSON jsonFile;
fetcher = if repoMeta.type == "savannah" then
pkgs.fetchFromSavannah
else if repoMeta.type == "github" then
pkgs.fetchFromGitHub
else
throw "Unknown repository type ${repoMeta.type}!";
in builtins.foldl' (drv: fn: fn drv) pkgs.emacs [
(drv: drv.override ({ srcRepo = true; } // args))
# in order for this build to be differentiated from original `nixpkgs.emacs`
(drv:
drv.overrideAttrs (old: {
name = "${namePrefix}-${repoMeta.version}";
inherit (repoMeta) version;
inherit patches;
src = fetcher (builtins.removeAttrs repoMeta [ "type" "version" ]);
postPatch = old.postPatch + ''
substituteInPlace lisp/loadup.el \
--replace '(emacs-repository-get-version)' '"${repoMeta.rev}"' \
--replace '(emacs-repository-get-branch)' '"master"'
'';
# https://github.com/NixOS/nixpkgs/issues/109997#issuecomment-867318377
CFLAGS = "-DMAC_OS_X_VERSION_MAX_ALLOWED=110200 -g -O2";
}))
];
emacsOsx = mkGitEmacs "emacs-osx" ./emacs-source/emacs-master.json [ ] { };
emacsOsxNative = mkGitEmacs "emacs-osx" ./emacs-source/emacs-master.json [ ] {
nativeComp = true;
};
emacsOsxTile = mkGitEmacs "emacs-osx" ./emacs-source/emacs-master.json [
./patches/no-titlebar.patch
./patches/fix-window-role-yabai.patch
] { };
emacsOsxNativeTile = mkGitEmacs "emacs-osx" ./emacs-source/emacs-master.json [
./patches/no-titlebar.patch
./patches/fix-window-role-yabai.patch
] { nativeComp = true; };
in _: _: {
inherit emacsOsx;
inherit emacsOsxNative;
# for use in chunwm or yabai
inherit emacsOsxTile;
inherit emacsOsxNativeTile;
}