Move Emacs font settings to theme, which is then loaded in extraConfig
This commit is contained in:
parent
9626796c46
commit
ab7790b983
|
@ -23,20 +23,31 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.emacs29-pgtk;
|
package = pkgs.emacs29-pgtk;
|
||||||
extraConfig = let
|
extraConfig = let
|
||||||
shell = "${pkgs.zsh}/bin/zsh";
|
|
||||||
font = "${fonts.monospace.name}-${toString fonts.sizes.applications}";
|
|
||||||
fixed-font-family = "${fonts.monospace.name}";
|
fixed-font-family = "${fonts.monospace.name}";
|
||||||
variable-font-family = "${fonts.sansSerif.name}";
|
variable-font-family = "${fonts.sansSerif.name}";
|
||||||
alpha = "100"; # "90";
|
custom-theme-name = "nix";
|
||||||
|
custom-theme = pkgs.writeTextFile {
|
||||||
|
name = "custom-emacs-theme";
|
||||||
|
destination = "/${custom-theme-name}-theme.el";
|
||||||
|
text = ''
|
||||||
|
(deftheme ${custom-theme-name}
|
||||||
|
"Use Nix customised fonts for main faces")
|
||||||
|
|
||||||
|
(custom-theme-set-faces
|
||||||
|
'${custom-theme-name}
|
||||||
|
'(default ((t (:family "${fixed-font-family}" :height 120))))
|
||||||
|
'(fixed-pitch ((t (:family "${fixed-font-family}"))))
|
||||||
|
'(fixed-pitch-serif ((t (:family "${fixed-font-family}"))))
|
||||||
|
'(variable-pitch ((t (:family "${variable-font-family}")))))
|
||||||
|
|
||||||
|
(provide-theme '${custom-theme-name})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el";
|
||||||
in ''
|
in ''
|
||||||
(customize-set-variable 'shell-file-name "${shell}")
|
(add-to-list 'custom-theme-load-path "${custom-theme}")
|
||||||
(add-to-list 'initial-frame-alist '(font . "${font}"))
|
(add-to-list 'custom-safe-themes "${custom-theme-hash}")
|
||||||
(add-to-list 'default-frame-alist '(font . "${font}"))
|
(load-theme '${custom-theme-name})
|
||||||
(set-face-attribute 'fixed-pitch nil :family "${fixed-font-family}")
|
|
||||||
(set-face-attribute 'fixed-pitch-serif nil :family "${fixed-font-family}")
|
|
||||||
(set-face-attribute 'variable-pitch nil :family "${variable-font-family}")
|
|
||||||
(add-to-list 'initial-frame-alist '(alpha-background . ${alpha}))
|
|
||||||
(add-to-list 'default-frame-alist '(alpha-background . ${alpha}))
|
|
||||||
'';
|
'';
|
||||||
extraPackages = epkgs:
|
extraPackages = epkgs:
|
||||||
with epkgs; [
|
with epkgs; [
|
||||||
|
|
Reference in a new issue