Emacs: use stylix to customise base16-theme package
Add my custom modifications from README.el to extraConfig.el
This commit is contained in:
parent
9e21c14c35
commit
5b9f7e1e11
|
@ -5,7 +5,6 @@
|
||||||
../shell/git.nix
|
../shell/git.nix
|
||||||
../gpg/default.nix
|
../gpg/default.nix
|
||||||
];
|
];
|
||||||
stylix.targets.emacs.enable = false;
|
|
||||||
services.emacs = {
|
services.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = config.programs.emacs.finalPackage;
|
package = config.programs.emacs.finalPackage;
|
||||||
|
@ -21,47 +20,12 @@
|
||||||
withImageMagick = true;
|
withImageMagick = true;
|
||||||
withPgtk = true;
|
withPgtk = true;
|
||||||
};
|
};
|
||||||
extraConfig =
|
extraConfig = builtins.readFile ./extraConfig.el;
|
||||||
let
|
|
||||||
fixed-font-family = "${config.stylix.fonts.monospace.name}";
|
|
||||||
variable-font-family = "${config.stylix.fonts.sansSerif.name}";
|
|
||||||
font-height = builtins.toString (
|
|
||||||
builtins.floor (builtins.mul config.stylix.fonts.sizes.applications 10)
|
|
||||||
);
|
|
||||||
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-variables
|
|
||||||
'${custom-theme-name}
|
|
||||||
'(menu-bar-mode nil))
|
|
||||||
|
|
||||||
(custom-theme-set-faces
|
|
||||||
'${custom-theme-name}
|
|
||||||
'(default ((t (:family "${fixed-font-family}" :height ${font-height}))))
|
|
||||||
'(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
|
|
||||||
''
|
|
||||||
(add-to-list 'custom-theme-load-path "${custom-theme}")
|
|
||||||
(add-to-list 'custom-safe-themes "${custom-theme-hash}")
|
|
||||||
(load-theme '${custom-theme-name})
|
|
||||||
'';
|
|
||||||
extraPackages =
|
extraPackages =
|
||||||
epkgs: with epkgs; [
|
epkgs: with epkgs; [
|
||||||
treesit-grammars.with-all-grammars
|
treesit-grammars.with-all-grammars
|
||||||
mu4e
|
|
||||||
emacsql-sqlite
|
emacsql-sqlite
|
||||||
|
mu4e
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|
42
system/home/emacs/extraConfig.el
Normal file
42
system/home/emacs/extraConfig.el
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
(defun my/configure-theme ()
|
||||||
|
"Load theme and configure some faces."
|
||||||
|
(interactive)
|
||||||
|
|
||||||
|
;; Set some font-lock faces to be italic
|
||||||
|
(set-face-attribute 'font-lock-doc-face nil :slant 'italic)
|
||||||
|
(set-face-attribute 'font-lock-comment-face nil :slant 'italic)
|
||||||
|
(set-face-attribute 'font-lock-comment-delimiter-face nil :slant 'italic)
|
||||||
|
|
||||||
|
;; Change outline headers to follow rainbow order
|
||||||
|
(require 'outline)
|
||||||
|
(when (boundp 'base16-stylix-theme-colors)
|
||||||
|
(dolist (pairing '((outline-1 . :base08)
|
||||||
|
(outline-2 . :base09)
|
||||||
|
(outline-3 . :base0A)
|
||||||
|
(outline-4 . :base0B)
|
||||||
|
(outline-5 . :base0C)
|
||||||
|
(outline-6 . :base0D)
|
||||||
|
(outline-7 . :base0E)
|
||||||
|
(outline-8 . :base0F)))
|
||||||
|
(set-face-attribute (car pairing) nil
|
||||||
|
:foreground
|
||||||
|
(plist-get base16-stylix-theme-colors (cdr pairing))))
|
||||||
|
|
||||||
|
(require 'org-faces)
|
||||||
|
;; Lighten `org-agenda-clocking' background to be more legible.
|
||||||
|
(set-face-attribute 'org-agenda-clocking nil :background
|
||||||
|
(plist-get base16-stylix-theme-colors :base01))
|
||||||
|
;; Set `org-hide' face to actually match background colour
|
||||||
|
(set-face-attribute 'org-hide nil :foreground
|
||||||
|
(plist-get base16-stylix-theme-colors :base00))
|
||||||
|
(with-eval-after-load 'org-noter
|
||||||
|
(set-face-attribute 'org-noter-no-notes-exist-face nil :foreground
|
||||||
|
(plist-get base16-stylix-theme-colors :base08))
|
||||||
|
(set-face-attribute 'org-noter-notes-exist-face nil :foreground
|
||||||
|
(plist-get base16-stylix-theme-colors :base0B))))
|
||||||
|
)
|
||||||
|
|
||||||
|
(with-eval-after-load 'base16-theme
|
||||||
|
(require 'server)
|
||||||
|
(add-hook 'after-init-hook (lambda () (my/configure-theme)))
|
||||||
|
(add-hook 'server-after-make-frame-hook (lambda () (my/configure-theme))))
|
Loading…
Reference in a new issue