Add support for non-graphical emacs.

This commit is contained in:
Tom Alexander 2025-01-23 01:52:37 -05:00
parent 054e056d00
commit e0644a069d
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE

View File

@ -63,9 +63,9 @@ in
lib.mkMerge [ lib.mkMerge [
{ {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
emacs29-pgtk my_emacs
(plainmacs emacs29-pgtk) (plainmacs my_emacs)
(e_shorthand emacs29-pgtk) (e_shorthand my_emacs)
]; ];
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
@ -84,35 +84,49 @@ in
}; };
}; };
environment.variables.EDITOR = "${pkgs.emacs29-pgtk}/bin/plainmacs"; environment.variables.EDITOR = "${pkgs.my_emacs}/bin/plainmacs";
} }
(lib.mkIf (config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_emacs = final.emacs29-pgtk;
})
];
})
(lib.mkIf (!config.me.graphical) {
nixpkgs.overlays = [
(final: prev: {
my_emacs = final.emacs-nox;
})
];
})
(lib.mkIf (config.me.emacs_flavor == "full") { (lib.mkIf (config.me.emacs_flavor == "full") {
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
emacs29-pgtk = pkgs.buildEnv { my_emacs = pkgs.buildEnv {
name = prev.emacs29-pgtk.name; name = prev.my_emacs.name;
paths = with prev; [ paths = with prev; [
emacs29-pgtk my_emacs
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"
"doc" "doc"
"info" "info"
]; ];
buildInputs = [ pkgs.makeWrapper ]; buildInputs = [ final.makeWrapper ];
postBuild = '' postBuild = ''
wrapProgram $out/bin/emacs --prefix PATH : ${ wrapProgram $out/bin/emacs --prefix PATH : ${
lib.makeBinPath [ lib.makeBinPath [
(pkgs.aspellWithDicts ( (final.aspellWithDicts (
dicts: with dicts; [ dicts: with dicts; [
en en
en-computers en-computers
] ]
)) ))
pkgs.nixd # nix language server final.nixd # nix language server
pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd final.nixfmt-rfc-style # auto-formatting nix files through nixd
pkgs.clang # To compile tree-sitter grammars final.clang # To compile tree-sitter grammars
pkgs.shellcheck final.shellcheck
] ]
} }
''; '';
@ -132,10 +146,10 @@ in
(lib.mkIf (config.me.emacs_flavor == "plainmacs") { (lib.mkIf (config.me.emacs_flavor == "plainmacs") {
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
emacs29-pgtk = pkgs.buildEnv { my_emacs = pkgs.buildEnv {
name = prev.emacs29-pgtk.name; name = prev.my_emacs.name;
paths = with prev; [ paths = with prev; [
emacs29-pgtk my_emacs
]; ];
extraOutputsToInstall = [ extraOutputsToInstall = [
"man" "man"