wip: feat: Just use straight.el...

Every Nixy solution I could find or conceive had too many points spread across
these various facets:
  - Flimsy (emacsWithPackagesFromUsePackage)
  - Inelegant (builtins.exec, manual listings)
  - Inflexible (emacsWithPackagesFromUsePackage)
  - Otherwise unergonomic (everything }:D)

Straight.el is sufficiently declarative, flexible, and Nix-friendly without
blindly bowing down to the imperialist NixOS user.  Now, Convenience and
ergonomics shan't be forsaken for the dogma that is total Nixation.
This commit is contained in:
Madeleine Sydney
2025-01-05 00:56:03 -07:00
parent b23492e42b
commit 1aee1366c2
5 changed files with 83 additions and 19 deletions

View File

@@ -17,8 +17,8 @@ let
# 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;
# 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 {
@@ -26,20 +26,32 @@ let
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"))
straightBaseDir = "${config.xdg.dataHome}/straight";
emacsWrapper = pkgs.symlinkJoin {
name = "emacs-wrapper";
paths = [ emacsPackage ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
for i in $out/bin/emacs-*; do
wrapProgram "$i" \
--add-flags "--init-directory \"${emacsConfigDir}\""
done
'';
};
in {
sydnix.impermanence.cache.directories = [ straightBaseDir ];
home.packages = [ emacsWrapper ];
home.sessionVariables.EMACS_STRAIGHT_BASE_DIR = straightBaseDir;
# programs.emacs = {
# enable = true;
# package = emacsPackage;
# # extraConfig = ''
# # (load (file-name-concat "${emacsConfigDir}" "init"))
# # '';
# };
services.emacs = {
enable = true;