wip: feat: Emacs config (from scratch }:3)

Working:
  - The daemon
  - Mutable config — well, kinda. I'm not yet sure how it will interact with
    `emacsWithPackagesFromUsePackage`.
  - Packages via Nixpkgs
This commit is contained in:
Madeleine Sydney
2025-01-03 17:06:49 -07:00
parent c3cecf6a1c
commit b23492e42b
4 changed files with 88 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
{ config, lib, pkgs, inputs, ... }@args:
# NOTE: Remember to wrap `programs.emacs.finalPackage` rather than pass a
# wrapped package to `programs.emacs.package`, lest some unexpected behaviour
# occur when home-manager calls emacs during the build process.
let
emacsPackage = pkgs.emacs30-pgtk;
emacsConfigDir = "/persist/dots/users/crumb/programs/emacs";
emacs-overlay =
import (builtins.fetchTarball {
url =
"https://github.com/nix-community/emacs-overlay/archive/master.tar.gz";
sha256 = "sha256:02aln37ch9isz8h7dlm9v6jkl60g923z0dij0rjsxq7xi61fas2j";
});
# Create a new instance of nixpkgs with emacs-overlay applied. This is a
# little unorthodox, but we do it
# 1. for the sake of organisation — For pure aesthetics and a clean codebase, I want
# everything Emacs to stay in this file;
# 2. and, there's simply no need to leak emacs-overlay's packages into the
# global nixpkgs instance when nothing else is using it!
pkgs' = import inputs.nixpkgs {
system = args.system;
overlays = [ emacs-overlay ];
};
my-emacs = pkgs'.emacsWithPackagesFromUsePackage {
config = ./emacs/init.el;
defaultInitFile = false;
package = emacsPackage;
alwaysEnsure = true;
};
in {
programs.emacs = {
enable = true;
package = my-emacs;
extraConfig = ''
(load (file-name-concat "${emacsConfigDir}" "init"))
'';
};
services.emacs = {
enable = true;
# Generate a desktop entry for emacsclient.
client.enable = true;
};
}

View File

@@ -0,0 +1,6 @@
;; -*- lexical-binding: t; -*-
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(use-package evil)