Move emacs config to nix

This commit is contained in:
Erwin Boskma 2023-03-04 14:25:40 +01:00
parent 75a412de40
commit c6a9091ea7
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
3 changed files with 1619 additions and 5 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,28 @@
with lib; let
cfg = config.eboskma.programs.emacs;
emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage {
# config = ./config.org;
config =
let
tangledOrgConfig = pkgs.runCommand "tangled-emacs-config" { } ''
cp ${./config.org} ./config.org
${cfg.package}/bin/emacs --batch -Q ./config.org -f org-babel-tangle
cp init.el $out
'';
in
builtins.readFile tangledOrgConfig;
defaultInitFile = true;
package = cfg.package;
alwaysEnsure = true;
alwaysTangle = true;
extraEmacsPackages = epkgs: [
epkgs.emacsql
epkgs.emacsql-sqlite
];
};
orgProtocolDesktop = pkgs.makeDesktopItem {
name = "org-protocol";
desktopName = "Emacs Org Protocol Handler";
@ -13,7 +35,8 @@ with lib; let
categories = [ "Development" "TextEditor" ];
keywords = [ "org-protocol" ];
type = "Application";
exec = "${cfg.package}/bin/emacsclient -- %u";
# exec = "${cfg.package}/bin/emacsclient -- %u";
exec = "${emacsWithPackages}/bin/emacsclient -- %u";
terminal = false;
mimeTypes = [ "x-scheme-handler/org-protocol" ];
startupWMClass = "Emacs";
@ -40,12 +63,14 @@ in
config = mkIf cfg.enable {
programs.emacs = {
enable = true;
package = cfg.package;
# package = cfg.package;
package = emacsWithPackages;
};
services.emacs = mkIf cfg.daemon {
enable = true;
package = cfg.package;
# package = cfg.package;
package = emacsWithPackages;
client.enable = true;
socketActivation.enable = true;
};
@ -58,7 +83,8 @@ in
nodePackages.bash-language-server
aspell
nil
python310
python3
lldb
] ++
(with aspellDicts; [ en en-computers en-science fy nl ]);

View file

@ -32,7 +32,8 @@ in
dunst.enable = false;
emacs = {
enable = true;
package = with pkgs; ((emacsPackagesFor emacsPgtk).emacsWithPackages (epkgs: [ epkgs.emacsql epkgs.emacsql-sqlite ]));
# package = with pkgs; ((emacsPackagesFor emacsPgtk).emacsWithPackages (epkgs: [ epkgs.emacsql epkgs.emacsql-sqlite ]));
package = pkgs.emacsPgtk;
daemon = true;
};
electron = {