Skip to content

Commit

Permalink
emacs: simplifications for darwin portability
Browse files Browse the repository at this point in the history
  • Loading branch information
loganlinn committed Oct 10, 2024
1 parent 311a5ce commit cce6380
Show file tree
Hide file tree
Showing 8 changed files with 286 additions and 314 deletions.
2 changes: 1 addition & 1 deletion darwin/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let
in
{
users.users.${my.user.name} = {
inherit (my.user) description shell openssh;
inherit (my.user) description shell openssh packages;
home = "/Users/${my.user.name}";
};

Expand Down
1 change: 1 addition & 0 deletions darwin/logamma/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ in
../../nix/home/dev/nodejs.nix
../../nix/home/pretty.nix
../../nix/home/kitty
../../nix/home/doom
../../nix/modules/programs/nixvim
];

Expand Down
63 changes: 17 additions & 46 deletions darwin/modules/emacs.nix
Original file line number Diff line number Diff line change
@@ -1,48 +1,19 @@
{
options,
config,
lib,
pkgs,
...
}:

let
# cfg = config.my.darwin.emacs;
in
{
# options.my.darwin.emacs = with lib; {
# enable = mkEnableOption "emacs";
# version = mkOption {
# type = types.str;
# default = "31";
# };
# };

config = {
homebrew.enable = true;

homebrew.taps = [
{
name = "d12frosted/emacs-plus";
}
];

homebrew.brews = [
{
name = "emacs-plus@31";
args = [
"verbose"
"with-c9rgreen-sonoma-icon"
# "with-imagemagick"
"with-native-comp" # build with native compilation aka gccemacs
# "with-debug" # build with debug symbols and debugger friendly optimizations
# "with-poll" # build with poll() instead of select() to enable more file descriptors
# "with-xwidgets" # build with native macos webkit support
# "with-no-frame-refocus" # disables frame re-focus (ie. closing one frame does not refocus another one)
];
}
];

environment.systemPackages = [ pkgs.jq ];
};
homebrew.enable = true;
homebrew.taps = [ { name = "d12frosted/emacs-plus"; } ];
homebrew.brews = [
{
name = "emacs-plus@31";
args = [
"verbose"
"with-c9rgreen-sonoma-icon"
# "with-imagemagick"
"with-native-comp" # build with native compilation aka gccemacs
# "with-debug" # build with debug symbols and debugger friendly optimizations
# "with-poll" # build with poll() instead of select() to enable more file descriptors
# "with-xwidgets" # build with native macos webkit support
# "with-no-frame-refocus" # disables frame re-focus (ie. closing one frame does not refocus another one)
];
}
];
}
41 changes: 41 additions & 0 deletions nix/home/doom/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
config,
lib,
pkgs,
...
}:

with lib;

let
emacsdir = "${config.xdg.configHome}/emacs";
doomdir = "${config.xdg.configHome}/doom";
in
{
home.packages =
(with pkgs; [
binutils # for native-comp
emacs-all-the-icons-fonts
])
++ (concatLists (attrValues (import ./packages.nix pkgs)));

home.sessionPath = [ "${emacsdir}/bin" ];

home.sessionVariables.EMACSDIR = "${removeSuffix "/" emacsdir}/"; # trailing sep expected
home.sessionVariables.DOOMDIR = "${removeSuffix "/" doomdir}/"; # trailing sep expected

home.activation = {
setupDoomEmacsConfig = hm.dag.entryAfter [ "writeBoundary" ] ''
if ! [ -d "${emacsdir}" ]; then
run ${pkgs.git}/bin/git clone $VERBOSE_ARG --depth=1 --single-branch "https://github.com/doomemacs/doomemacs.git" "${emacsdir}"
run "${emacsdir}"/bin/doom install
fi
'';

setupDoomPrivateConfig = hm.dag.entryBefore [ "setupDoomEmacsConfig" ] ''
if ! [ -d "${doomdir}" ]; then
run ${pkgs.git}/bin/git clone $VERBOSE_ARG https://github.com/loganlinn/.doom.d.git "${doomdir}"
fi
'';
};
}
96 changes: 96 additions & 0 deletions nix/home/doom/packages.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# External requirements for Doom modules.
# These are derived from the "Installation" section from module READMEs.
# See: https://github.com/doomemacs/doomemacs/tree/master/modules
# TODO devise a way for this to be linked with init.el.
pkgs: with pkgs; {
":app irc" = [ gnutls ];

":checkers spell +aspell" = [
(aspellWithDicts (
ds: with ds; [
en
en-computers
en-science
]
))
];

":editor format" = [ nodePackages.prettier ];

":emacs dired" = [
fd
ffmpegthumbnailer
gnutar
imagemagick
mediainfo
poppler_utils
unzip
];

":emacs undo" = [ zstd ];

# ":lang clojure +lsp" = [ clojure-lsp ];

# ":lang elixir +lsp" = [ elixir-ls ];

# ":lang go +lsp" = [ gopls ];

# ":lang java +lsp" = [ java-language-server ];

":lang latex" = [ texlive.combined.scheme-medium ];

":lang org +gnuplot" = [ gnuplot ];

":lang org +pandoc" = [ pandoc ];

":lang org +roam" = [ sqlite ];

":lang sh +lsp" = [ bash-language-server ];

":lang sh" = [
shellcheck
shfmt
];

# ":lang terraform" = [ terraform ];

# ":lang zig +lsp" = [ zls ];

# ":term vterm" = {
# programs.emacs.extraPackages = epkgs: [ epkgs.vterm ];
# };

":tools direnv" = [ direnv ];

":tools editorconfig" = [ editorconfig-core-c ];

":tools just" = [ just ];

":tools lookup" = [
ripgrep
sqlite
wordnet
];

":tools make" = [ gnumake ];

":tools pass" = [
pass
gnupg
];

# ":tools pdf" = [
# # for building epdfinfo (i.e. M-x pdf-tools-install)
# pkgconfig
# autoconf
# automake
# libpng
# zlib
# poppler
# poppler_gi
# ];

# ":lang hugo" = [hugo];

# ":lang org +jupyter" = [(python3.withPackages(ps: with ps; [jupyter]))];
}
Loading

0 comments on commit cce6380

Please sign in to comment.