Skip to content

Commit cce6380

Browse files
committed
emacs: simplifications for darwin portability
1 parent 311a5ce commit cce6380

File tree

8 files changed

+286
-314
lines changed

8 files changed

+286
-314
lines changed

darwin/common.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let
55
in
66
{
77
users.users.${my.user.name} = {
8-
inherit (my.user) description shell openssh;
8+
inherit (my.user) description shell openssh packages;
99
home = "/Users/${my.user.name}";
1010
};
1111

darwin/logamma/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ in
3838
../../nix/home/dev/nodejs.nix
3939
../../nix/home/pretty.nix
4040
../../nix/home/kitty
41+
../../nix/home/doom
4142
../../nix/modules/programs/nixvim
4243
];
4344

darwin/modules/emacs.nix

+17-46
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,19 @@
11
{
2-
options,
3-
config,
4-
lib,
5-
pkgs,
6-
...
7-
}:
8-
9-
let
10-
# cfg = config.my.darwin.emacs;
11-
in
12-
{
13-
# options.my.darwin.emacs = with lib; {
14-
# enable = mkEnableOption "emacs";
15-
# version = mkOption {
16-
# type = types.str;
17-
# default = "31";
18-
# };
19-
# };
20-
21-
config = {
22-
homebrew.enable = true;
23-
24-
homebrew.taps = [
25-
{
26-
name = "d12frosted/emacs-plus";
27-
}
28-
];
29-
30-
homebrew.brews = [
31-
{
32-
name = "emacs-plus@31";
33-
args = [
34-
"verbose"
35-
"with-c9rgreen-sonoma-icon"
36-
# "with-imagemagick"
37-
"with-native-comp" # build with native compilation aka gccemacs
38-
# "with-debug" # build with debug symbols and debugger friendly optimizations
39-
# "with-poll" # build with poll() instead of select() to enable more file descriptors
40-
# "with-xwidgets" # build with native macos webkit support
41-
# "with-no-frame-refocus" # disables frame re-focus (ie. closing one frame does not refocus another one)
42-
];
43-
}
44-
];
45-
46-
environment.systemPackages = [ pkgs.jq ];
47-
};
2+
homebrew.enable = true;
3+
homebrew.taps = [ { name = "d12frosted/emacs-plus"; } ];
4+
homebrew.brews = [
5+
{
6+
name = "emacs-plus@31";
7+
args = [
8+
"verbose"
9+
"with-c9rgreen-sonoma-icon"
10+
# "with-imagemagick"
11+
"with-native-comp" # build with native compilation aka gccemacs
12+
# "with-debug" # build with debug symbols and debugger friendly optimizations
13+
# "with-poll" # build with poll() instead of select() to enable more file descriptors
14+
# "with-xwidgets" # build with native macos webkit support
15+
# "with-no-frame-refocus" # disables frame re-focus (ie. closing one frame does not refocus another one)
16+
];
17+
}
18+
];
4819
}

nix/home/doom/default.nix

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
8+
with lib;
9+
10+
let
11+
emacsdir = "${config.xdg.configHome}/emacs";
12+
doomdir = "${config.xdg.configHome}/doom";
13+
in
14+
{
15+
home.packages =
16+
(with pkgs; [
17+
binutils # for native-comp
18+
emacs-all-the-icons-fonts
19+
])
20+
++ (concatLists (attrValues (import ./packages.nix pkgs)));
21+
22+
home.sessionPath = [ "${emacsdir}/bin" ];
23+
24+
home.sessionVariables.EMACSDIR = "${removeSuffix "/" emacsdir}/"; # trailing sep expected
25+
home.sessionVariables.DOOMDIR = "${removeSuffix "/" doomdir}/"; # trailing sep expected
26+
27+
home.activation = {
28+
setupDoomEmacsConfig = hm.dag.entryAfter [ "writeBoundary" ] ''
29+
if ! [ -d "${emacsdir}" ]; then
30+
run ${pkgs.git}/bin/git clone $VERBOSE_ARG --depth=1 --single-branch "https://github.com/doomemacs/doomemacs.git" "${emacsdir}"
31+
run "${emacsdir}"/bin/doom install
32+
fi
33+
'';
34+
35+
setupDoomPrivateConfig = hm.dag.entryBefore [ "setupDoomEmacsConfig" ] ''
36+
if ! [ -d "${doomdir}" ]; then
37+
run ${pkgs.git}/bin/git clone $VERBOSE_ARG https://github.com/loganlinn/.doom.d.git "${doomdir}"
38+
fi
39+
'';
40+
};
41+
}

nix/home/doom/packages.nix

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# External requirements for Doom modules.
2+
# These are derived from the "Installation" section from module READMEs.
3+
# See: https://github.com/doomemacs/doomemacs/tree/master/modules
4+
# TODO devise a way for this to be linked with init.el.
5+
pkgs: with pkgs; {
6+
":app irc" = [ gnutls ];
7+
8+
":checkers spell +aspell" = [
9+
(aspellWithDicts (
10+
ds: with ds; [
11+
en
12+
en-computers
13+
en-science
14+
]
15+
))
16+
];
17+
18+
":editor format" = [ nodePackages.prettier ];
19+
20+
":emacs dired" = [
21+
fd
22+
ffmpegthumbnailer
23+
gnutar
24+
imagemagick
25+
mediainfo
26+
poppler_utils
27+
unzip
28+
];
29+
30+
":emacs undo" = [ zstd ];
31+
32+
# ":lang clojure +lsp" = [ clojure-lsp ];
33+
34+
# ":lang elixir +lsp" = [ elixir-ls ];
35+
36+
# ":lang go +lsp" = [ gopls ];
37+
38+
# ":lang java +lsp" = [ java-language-server ];
39+
40+
":lang latex" = [ texlive.combined.scheme-medium ];
41+
42+
":lang org +gnuplot" = [ gnuplot ];
43+
44+
":lang org +pandoc" = [ pandoc ];
45+
46+
":lang org +roam" = [ sqlite ];
47+
48+
":lang sh +lsp" = [ bash-language-server ];
49+
50+
":lang sh" = [
51+
shellcheck
52+
shfmt
53+
];
54+
55+
# ":lang terraform" = [ terraform ];
56+
57+
# ":lang zig +lsp" = [ zls ];
58+
59+
# ":term vterm" = {
60+
# programs.emacs.extraPackages = epkgs: [ epkgs.vterm ];
61+
# };
62+
63+
":tools direnv" = [ direnv ];
64+
65+
":tools editorconfig" = [ editorconfig-core-c ];
66+
67+
":tools just" = [ just ];
68+
69+
":tools lookup" = [
70+
ripgrep
71+
sqlite
72+
wordnet
73+
];
74+
75+
":tools make" = [ gnumake ];
76+
77+
":tools pass" = [
78+
pass
79+
gnupg
80+
];
81+
82+
# ":tools pdf" = [
83+
# # for building epdfinfo (i.e. M-x pdf-tools-install)
84+
# pkgconfig
85+
# autoconf
86+
# automake
87+
# libpng
88+
# zlib
89+
# poppler
90+
# poppler_gi
91+
# ];
92+
93+
# ":lang hugo" = [hugo];
94+
95+
# ":lang org +jupyter" = [(python3.withPackages(ps: with ps; [jupyter]))];
96+
}

0 commit comments

Comments
 (0)