feat: Configure fonts

This commit is contained in:
Madeleine Sydney
2025-02-02 11:52:10 -07:00
parent ed588077de
commit 542d329c24
2 changed files with 48 additions and 4 deletions

View File

@@ -30,6 +30,12 @@ let
emacsCacheDir = "${emacsDataDir}/cache";
straightBaseDir = "${emacsDataDir}/straight";
fontPackages = [
pkgs.julia-mono
(pkgs.nerdfonts.override { fonts = [ "VictorMono" ]; })
pkgs.overpass
];
emacsWrapper = pkgs.symlinkJoin {
name = "emacs-wrapper";
paths = [ emacsPackage ];
@@ -38,12 +44,15 @@ let
pkgs.git # Dependency of Straight.el.
];
postBuild = ''
# The binary called `emacs` is actually a symlink to `emacs-«version»`, so
# we needn't wrap it.
for i in $out/bin/emacs-*; do
wrapProgram "$i" \
--add-flags "--init-directory \"${emacsConfigDir}\"" \
--set EMACS_STRAIGHT_BASE_DIR "${straightBaseDir}" \
--set EMACS_CACHE_DIR "${emacsCacheDir}" \
--set EMACS_DATA_DIR "${emacsDataDir}"
--set EMACS_DATA_DIR "${emacsDataDir}" \
--prefix PATH : "${pkgs.git}/bin"
done
'';
};
@@ -53,7 +62,13 @@ in {
(lib.removePrefix config.home.homeDirectory straightBaseDir)
];
home.packages = [ emacsWrapper ];
home.packages = [
emacsWrapper
] ++ fontPackages;
# There's probably a better place to put this, but the current setup demands
# Fontconfig for Emacs to find my fonts.
fonts.fontconfig.enable = true;
# TODO: Make sure this is using the right package for Emacs...
services.emacs = {

View File

@@ -1,12 +1,20 @@
;;; syd-ui.el -*- lexical-binding: t; -*-
(defvar syd-fixed-pitch-font
(font-spec :family "VictorMono NF" :size 13)
"Default fixed-pitch (monospace) font.")
(defvar syd-variable-pitch-font
(font-spec :family "Overpass" :size 15)
"Default variable-pitch font.")
;; Beautiful theme in dark and light.
(use-package kanagawa-themes
:config
(load-theme 'kanagawa-wave t))
;; Display (relative) line numbers only in prog-mode derivatives.
(use-package emacs
;; Display (relative) line numbers only in prog-mode derivatives.
:hook ((prog-mode-hook . display-line-numbers-mode))
:custom ((display-line-numbers-type 'relative)
;; Always ask "y/n"; never "yes/no".
@@ -28,9 +36,30 @@
;; Disable the menu bar, scroll bar, and tool bar.
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1))
(tool-bar-mode -1)
;; Configuring the defaults for newly-created frames:
;; Set default font.
;; (add-to-list 'default-frame-alist '(font . "VictorMono NF"))
;; Disable the titlebar and borders (decorations).
(add-to-list 'default-frame-alist '(undecorated . t))
;; Maximise the window.
;; (add-to-list 'default-frame-alist '(fullscreen . maximized))
;; Set the default font... again? No! Earlier, we said "when creating a new
;; frame use this font." This call instead defines the face used for
;; "default" text to use this font.
(set-face-attribute 'default nil :font syd-fixed-pitch-font)
(set-face-attribute 'variable-pitch nil :font syd-variable-pitch-font)
;; Use JuliaMono as a fallback for some glyphs that VictorMono does not cover.
(dolist (char-range '((#x0250 . #x02af) ; IPA extensions
(#x2200 . #x22FF))) ; Mathematical operators
(set-fontset-font "fontset-default" char-range "JuliaMono")))
(use-package persp-mode
:disabled
:unless noninteractive
:commands persp-switch-to-buffer
:hook (on-init-ui . persp-mode)