2022-04-27 00:21:19 +02:00
|
|
|
{ pkgs
|
|
|
|
, config
|
|
|
|
, lib
|
|
|
|
, ...
|
2022-03-01 22:19:03 +01:00
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.eboskma.programs.emacs;
|
2022-08-18 14:41:46 +02:00
|
|
|
emacsX11 = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages (epkgs: [ epkgs.emacsql epkgs.emacsql-sqlite ]));
|
|
|
|
emacsWayland = with pkgs; ((emacsPackagesFor emacsPgtkNativeComp).emacsWithPackages (epkgs: [ epkgs.emacsql epkgs.emacsql-sqlite ]));
|
2022-04-22 00:14:35 +02:00
|
|
|
|
2022-03-28 14:26:33 +02:00
|
|
|
orgProtocolDesktop = pkgs.makeDesktopItem {
|
|
|
|
name = "org-protocol";
|
|
|
|
desktopName = "Emacs Org Protocol Handler";
|
|
|
|
icon = "emacs";
|
2022-04-27 00:21:19 +02:00
|
|
|
categories = [ "Development" "TextEditor" ];
|
|
|
|
keywords = [ "org-protocol" ];
|
2022-03-28 14:26:33 +02:00
|
|
|
type = "Application";
|
2022-08-18 14:41:46 +02:00
|
|
|
exec = "${cfg.package}/bin/emacsclient -- %u";
|
2022-03-28 14:26:33 +02:00
|
|
|
terminal = false;
|
2022-04-27 00:21:19 +02:00
|
|
|
mimeTypes = [ "x-scheme-handler/org-protocol" ];
|
2022-03-28 14:26:33 +02:00
|
|
|
startupWMClass = "Emacs";
|
|
|
|
};
|
2022-05-28 17:08:20 +02:00
|
|
|
|
|
|
|
valeToINI = generators.toINIWithGlobalSection {
|
|
|
|
mkKeyValue = generators.mkKeyValueDefault
|
|
|
|
{
|
|
|
|
mkValueString = v:
|
|
|
|
if builtins.isList v then builtins.concatStringsSep ", " v
|
|
|
|
else generators.mkValueStringDefault { } v;
|
|
|
|
} " = ";
|
|
|
|
};
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2022-03-28 14:26:33 +02:00
|
|
|
options.eboskma.programs.emacs = {
|
|
|
|
enable = mkEnableOption "activate emacs";
|
2022-07-29 09:57:50 +02:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
description = "The emacs package to install";
|
|
|
|
type = types.package;
|
2022-08-18 14:41:46 +02:00
|
|
|
default = emacsWayland;
|
2022-07-29 09:57:50 +02:00
|
|
|
};
|
2022-08-18 16:37:26 +02:00
|
|
|
|
2022-03-28 14:26:33 +02:00
|
|
|
daemon = mkOption {
|
|
|
|
description = "Whether to enable emacs daemon";
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
};
|
|
|
|
};
|
2022-02-09 08:13:16 +01:00
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
config = mkIf cfg.enable {
|
2022-02-03 22:57:53 +01:00
|
|
|
programs.emacs = {
|
|
|
|
enable = true;
|
2022-08-18 14:41:46 +02:00
|
|
|
package = cfg.package;
|
2022-02-03 22:57:53 +01:00
|
|
|
};
|
2022-03-28 14:26:33 +02:00
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
services.emacs = mkIf cfg.daemon {
|
2022-03-28 14:26:33 +02:00
|
|
|
enable = true;
|
2022-08-18 14:41:46 +02:00
|
|
|
package = cfg.package;
|
2022-03-28 14:26:33 +02:00
|
|
|
client.enable = true;
|
|
|
|
socketActivation.enable = true;
|
|
|
|
};
|
2022-03-18 21:14:51 +01:00
|
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
(texlive.combine {
|
|
|
|
inherit (texlive) scheme-small wrapfig ulem capt-of;
|
|
|
|
})
|
2022-03-29 09:31:35 +02:00
|
|
|
orgProtocolDesktop
|
2022-04-11 09:57:19 +02:00
|
|
|
nodePackages.bash-language-server
|
2022-06-24 11:17:11 +02:00
|
|
|
aspell
|
2022-08-04 19:06:24 +02:00
|
|
|
rnix-lsp
|
2022-06-24 11:17:11 +02:00
|
|
|
] ++
|
2022-06-28 09:00:27 +02:00
|
|
|
(with aspellDicts; [ en en-computers en-science fy nl ]);
|
2022-05-28 17:08:20 +02:00
|
|
|
|
2022-02-03 22:57:53 +01:00
|
|
|
};
|
|
|
|
}
|