Introduce a plainmacs emacs install flavor.

This commit is contained in:
Tom Alexander 2025-01-22 21:01:34 -05:00
parent 3f945f8ae3
commit d3ea8b3667
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 100 additions and 54 deletions

View File

@ -28,4 +28,5 @@
me.kodi.enable = true; me.kodi.enable = true;
me.bluetooth.enable = true; me.bluetooth.enable = true;
me.emacs_flavor = "plainmacs";
} }

View File

@ -34,4 +34,5 @@
me.sway.enable = true; me.sway.enable = true;
me.ansible.enable = true; me.ansible.enable = true;
me.emacs_flavor = "full";
} }

View File

@ -39,12 +39,29 @@ let
e_shorthand = pkgs.writeShellScriptBin "e" '' e_shorthand = pkgs.writeShellScriptBin "e" ''
exec ${pkgs.emacs_full}/bin/emacs "''${@}" exec ${pkgs.emacs_full}/bin/emacs "''${@}"
''; '';
plain_e_shorthand = pkgs.writeShellScriptBin "e" ''
exec ${pkgs.emacs29-pgtk}/bin/emacs "''${@}"
'';
in in
{ {
imports = [ ]; imports = [ ];
config = lib.mkMerge [ options.me.emacs_flavor = lib.mkOption {
{ type = lib.types.nullOr (
lib.types.enum [
"full"
"plainmacs"
]
);
default = null;
example = "full";
description = "What flavor of emacs to set up.";
};
config =
lib.mkIf config.me.emacs_flavor != null (
lib.mkMerge [
(lib.mkIf (config.me.emacs_flavor == "full") {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
plainmacs plainmacs
e_shorthand e_shorthand
@ -69,6 +86,7 @@ in
pkgs.nixd # nix language server pkgs.nixd # nix language server
pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd
pkgs.clang # To compile tree-sitter grammars pkgs.clang # To compile tree-sitter grammars
pkgs.shellcheck
] ]
} }
''; '';
@ -102,6 +120,32 @@ in
}; };
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs"; environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
} })
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
environment.systemPackages = with pkgs; [
emacs29-pgtk
plainmacs
plain_e_shorthand
]; ];
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
hideMounts = true;
users.talexander = {
directories = [
".config/emacs/eln-cache" # Installed packages
".config/emacs/elpa" # Installed packages
".config/emacs/private" # For recentf
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
];
files = [
".config/emacs/history" # For savehist
".config/emacs/.last-package-update-day" # For use-package
];
};
};
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
})
]
);
} }