[emacs] Modularize more and better pkg

Attempts to select the right emacs package based on whether the machine
is x11 only or not.
This commit is contained in:
2024-09-10 17:03:04 -07:00
parent 9ba6006fca
commit 18afc61e33
6 changed files with 101 additions and 70 deletions

View File

@@ -4,6 +4,29 @@ with lib;
let
cfg = config.roles.desktop;
basePackages = with pkgs; [
];
x11BasePackages = with pkgs; [
];
x11OnlyPackages = with pkgs; [
emacs
];
waylandBasePackages = with pkgs; [
grim
slurp
wl-clipboard
mako
];
waylandOnlyPackages = with pkgs; [
emacs-gtk
];
in
{
options.roles.desktop = {
@@ -40,12 +63,6 @@ in
programs.dconf.enable = true;
services.gnome.gnome-keyring.enable = true;
environment.systemPackages = with pkgs; mkIf (!cfg.x11Only) [
grim
slurp
wl-clipboard
mako
];
programs.sway = mkIf (!cfg.x11Only) {
enable = true;
wrapperFeatures.gtk = true;
@@ -73,6 +90,15 @@ in
virtualisation.docker.enable = true;
users.extraGroups.docker.members = [ "johno" ];
environment.systemPackages = with pkgs; mkMerge [
basePackages
x11BasePackages
(mkIf cfg.x11Only x11OnlyPackages)
# TODO: Do we need a "wayland only" mode?
(mkIf (!cfg.x11Only) waylandBasePackages)
(mkIf (!cfg.x11Only) waylandOnlyPackages)
];
};
}