nixos/modules/dev/editors/emacs/default.nix

171 lines
4.8 KiB
Nix
Raw Normal View History

2024-09-30 07:15:20 +04:00
{ outputs, options, config, lib, pkgs, inputs, ... }:
2024-08-01 16:24:09 +04:00
let
2023-09-16 11:52:57 +04:00
cfg = config.modules.dev.editors.emacs;
2024-10-13 14:46:37 +04:00
inherit (lib) mkForce;
# so we dont cry later on why texLive is MASSIVE
tex = (pkgs.texlive.combine {
2024-09-30 07:15:20 +04:00
inherit (pkgs.texlive)
scheme-basic dvisvgm dvipng # for preview and export as html
wrapfig amsmath ulem hyperref capt-of fontspec inputenx graphics etoolbox;
});
2024-06-14 20:40:00 +04:00
myEmacs = pkgs.emacsWithPackagesFromUsePackage {
2024-06-14 20:40:00 +04:00
config = ../../../../config/emacs/emacs.org;
2024-02-14 20:32:18 +04:00
package = cfg.package;
alwaysEnsure = true;
2024-06-14 20:40:00 +04:00
alwaysTangle = true;
extraEmacsPackages = epkgs: [
epkgs.use-package
epkgs.mu4e
2024-02-04 13:03:36 +04:00
# TODO make this check if EXWM is enabled or not
epkgs.exwm
2024-09-30 07:15:20 +04:00
# epkgs.sakomodules
2024-06-14 21:07:23 +04:00
epkgs.eglot-booster
2024-07-19 03:26:11 +04:00
epkgs.app-launcher
];
2024-06-14 21:07:23 +04:00
# add eglot-lsp-booster package
2024-09-30 07:15:20 +04:00
override = epkgs:
epkgs // {
eglot-booster = epkgs.trivialBuild {
pname = "eglot-booster";
version = "e19dd7ea81bada84c66e8bdd121408d9c0761fe6";
2024-06-14 21:07:23 +04:00
2024-09-30 07:15:20 +04:00
packageRequires = with pkgs; [ emacs-lsp-booster ];
2024-06-14 21:07:23 +04:00
2024-09-30 07:15:20 +04:00
src = pkgs.fetchFromGitHub {
owner = "jdtsmith";
repo = "eglot-booster";
rev = "e19dd7ea81bada84c66e8bdd121408d9c0761fe6";
hash = "sha256-vF34ZoUUj8RENyH9OeKGSPk34G6KXZhEZozQKEcRNhs=";
};
};
app-launcher = epkgs.melpaBuild {
pname = "app-launcher";
version = "1.0";
2024-07-19 03:16:25 +04:00
2024-09-30 07:15:20 +04:00
commit = "d5015e394b0a666a8c7c4d4bdf786266e773b145";
2024-07-19 03:30:50 +04:00
2024-09-30 07:15:20 +04:00
recipe = pkgs.writeText "recipe" ''
(app-launcher :repo "SebastienWae/app-launcher" :fetcher github)
'';
2024-07-19 03:30:50 +04:00
2024-09-30 07:15:20 +04:00
src = pkgs.fetchFromGitHub {
owner = "SebastienWae";
repo = "app-launcher";
rev = "d5015e394b0a666a8c7c4d4bdf786266e773b145";
hash = "sha256-d0d5rkuxK/zKpSCa1UTdpV7o+RDDsEeab56rI7xUJ1E=";
};
};
2024-07-19 03:16:25 +04:00
};
2024-06-14 20:40:00 +04:00
# override for modules
2024-09-30 07:15:20 +04:00
# override = epkgs: epkgs // {
# sakomodules = epkgs.trivialBuild {
# pname = "sakomodules";
# version = "lol";
2024-06-14 20:40:00 +04:00
2024-09-30 07:15:20 +04:00
# src = ../../../../config/emacs/modules;
2024-06-14 20:40:00 +04:00
2024-09-30 07:15:20 +04:00
# };
# };
};
2023-09-16 11:52:57 +04:00
in {
2023-09-04 12:59:43 +04:00
options.modules.dev.editors.emacs = {
2024-08-01 16:24:09 +04:00
enable = lib.mkEnableOption false;
daemon = lib.mkEnableOption true;
package = lib.mkOption {
type = with lib.types; package;
2024-02-14 20:31:00 +04:00
default = pkgs.emacs-unstable;
2024-02-14 20:29:49 +04:00
description = "pkgs. followed by the name of the emacs overlay package";
2024-02-14 20:19:37 +04:00
};
2023-09-04 12:59:43 +04:00
};
2024-08-01 16:24:09 +04:00
config = lib.mkIf cfg.enable {
2024-09-30 07:15:20 +04:00
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
2023-12-26 15:02:02 +04:00
# ues daemon
services.emacs = {
2024-08-05 01:45:23 +04:00
enable = cfg.daemon;
2023-12-26 15:02:02 +04:00
install = true;
# package = pkgs.emacs29-pgtk;
# package = pkgs.emacsWithPackagesFromUsePackage {
# config = ../../../../config/emacs/emacs.org;
# package = pkgs.emacs-unstable;
# alwaysEnsure = true;
# alwaysTangle = true;
# extraEmacsPackages = epkgs: [
# epkgs.use-package
# epkgs.mu4e
# ];
# };
package = myEmacs;
2023-12-26 15:02:02 +04:00
};
users.users.sako.packages = with pkgs; [
# direnv
direnv
2023-12-26 18:19:44 +04:00
# mu for email
mu
# email sync
offlineimap
2024-10-14 07:13:00 +04:00
(isync.override { withCyrusSaslXoauth2 = true; })
2024-10-14 06:35:02 +04:00
# oauth
oama
2024-07-14 15:11:38 +04:00
# protonmail
hydroxide
2024-10-13 17:36:50 +04:00
# send mail
msmtp
2024-01-20 12:01:08 +04:00
# org to pdf
tex
# lsp
emacs-lsp-booster
2024-09-18 13:45:34 +04:00
# zenity-color-picker
zenity
2024-09-28 15:50:53 +04:00
# org-wild-notifier
libnotify
2024-09-30 07:15:20 +04:00
# wakatime-mode
wakatime-cli
2023-12-26 15:02:02 +04:00
];
2023-12-25 22:59:05 +04:00
2024-07-14 15:44:43 +04:00
systemd.services.hydroxide = {
enable = true;
description = "Unofficial Protonmail Bridge";
serviceConfig = {
User = "sako";
Type = "simple";
};
2024-07-14 15:47:56 +04:00
script = "${pkgs.hydroxide}/bin/hydroxide serve";
2024-07-14 15:46:31 +04:00
wantedBy = [ "multi-user.target" ];
2024-07-14 15:44:43 +04:00
};
2024-08-13 01:57:11 +04:00
# services.pantalaimon-headless.instances = {
# "wires.cafe" = {
# ssl = true;
# homeserver = "https://matrix.wires.cafe";
# listenAddress = "127.0.0.1";
# };
# };
2024-08-13 01:45:18 +04:00
2024-09-30 07:15:20 +04:00
home-manager.users.sako = { lib, ... }: {
2023-12-26 15:02:02 +04:00
home.file = {
2024-09-30 07:15:20 +04:00
".emacs.d/init.el".source = pkgs.runCommand "init.el" { } ''
2024-06-14 20:40:00 +04:00
cp ${../../../../config/emacs/emacs.org} emacs.org
2024-09-18 13:34:55 +04:00
${myEmacs}/bin/emacs -Q --batch ./emacs.org -f org-babel-tangle
2024-06-14 20:40:00 +04:00
mv init.el $out
'';
2024-06-21 23:34:37 +04:00
".emacs.d/icon.png".source = ../../../../config/emacs/icon.png;
# ".mbsyncrc".source = ../../../../config/emacs/.mbsyncrc;
2024-09-23 11:54:50 +04:00
".offlineimaprc".source = ../../../../config/emacs/.offlineimaprc;
2024-09-23 11:56:17 +04:00
".offlineimap.py".source = ../../../../config/emacs/.offlineimap.py;
2024-10-23 09:01:13 +04:00
".msmtprc".source = ../../../../config/emacs/.msmtprc;
2023-12-26 15:02:02 +04:00
};
};
2023-12-26 14:53:46 +04:00
2024-10-13 14:46:37 +04:00
programs.gnupg.agent.pinentryPackage = mkForce pkgs.pinentry-emacs;
2023-12-23 21:39:52 +04:00
fonts.packages = with pkgs; [
2024-09-30 07:15:20 +04:00
(nerdfonts.override { fonts = [ "JetBrainsMono" ]; })
2023-10-05 07:37:12 +04:00
jetbrains-mono
2023-09-05 13:41:34 +04:00
];
2023-09-04 12:59:43 +04:00
};
}