dev.fron.io nixrc / 8044d18
users(emacs): try dumping! Tony Olagbaiye a month ago
2 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
3535 elc = "${built-init.out}/share/emacs/site-lisp/init.elc";
3636 };
3737 early-init.el = (import ./early-init.nix args).out;
38 state.pdmp = (pkgs.runCommand "emacs-state.pdmp" {
39 buildInputs = [ cfg.finalPackage ];
40 HOME = "/tmp";
41 } ''
42 emacs --batch \
43 -l ${early-init.el} \
44 --eval '(setq pdmp/state (quote dumping))' \
45 -l ${init.el} \
46 --eval '(setq pdmp/state (quote dumped))' \
47 --eval '(setq pdmp/load-path load-path)' \
48 --eval '(dump-emacs-portable "'$out'")'
49 '').out;
3850 in {
3951 ".emacs.d/early-init.el".source = early-init.el;
4052 ".emacs.d/init.el".source = init.el;
4153 #".emacs.d/init.elc".source = init.elc; # hmm.
4254 ".emacs.d/init.d".source = "${cfg.finalPackage.deps}/share/emacs";
55 ".emacs.d/state.pdmp".source = state.pdmp;
4356 };
4457
4558 home.packages = with pkgs; systemDeps ++ [
3333
3434 # Setup base packaging - leaf
3535 package-init = ''
36 (defvar pdmp/state nil
37 "operational state with regards to dump file.")
38
39 (defmacro pdmp/if-dumping (then &rest else)
40 "Evaluate THEN if batch creating a dump file, else evaluate ELSE."
41 (declare (indent 1))
42 `(if (and noninteractive (eq pdmp/state 'dumping))
43 ,then
44 ,@else))
45
46 (defmacro pdmp/if-dumped (then &rest else)
47 "Evaluate THEN if running with a dump file, else evaluate ELSE."
48 (declare (indent 1))
49 `(if (eq pdmp/state 'dumped)
50 ,then
51 ,@else))
52
3653 (require 'leaf)
3754 (leaf leaf-keywords
3855 :ensure t