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:
@@ -364,3 +364,4 @@ Following is a subset of the many places I've learnt from.
|
|||||||
- [cite:@zaynetdinov2024you]
|
- [cite:@zaynetdinov2024you]
|
||||||
- [[https://prelude.emacsredux.com/en/stable/][Emacs Prelude]]
|
- [[https://prelude.emacsredux.com/en/stable/][Emacs Prelude]]
|
||||||
- [[https://github.com/doomemacs/doomemacs][Doom Emacs]]
|
- [[https://github.com/doomemacs/doomemacs][Doom Emacs]]
|
||||||
|
- [[https://cce.whatthefuck.computer/cce][Ryan Rix's Complete Computing Environment]]
|
||||||
|
|||||||
@@ -18,6 +18,28 @@ in {
|
|||||||
default = [];
|
default = [];
|
||||||
type = types.listOf types.anything;
|
type = types.listOf types.anything;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cache = {
|
||||||
|
directories = mkOption {
|
||||||
|
description = ''
|
||||||
|
While functionally identical to `directories` (at the moment),
|
||||||
|
`cache.directories` carries additional semantics: these directories
|
||||||
|
/can/ be erased, but typically /shouldn't/ be.
|
||||||
|
'';
|
||||||
|
default = [];
|
||||||
|
type = types.listOf types.anything;
|
||||||
|
};
|
||||||
|
|
||||||
|
files = mkOption {
|
||||||
|
description = ''
|
||||||
|
While functionally identical to `files` (at the moment),
|
||||||
|
`cache.files` carries additional semantics: these files /can/ be
|
||||||
|
erased, but typically /shouldn't/ be.
|
||||||
|
'';
|
||||||
|
default = [];
|
||||||
|
type = types.listOf types.anything;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -25,8 +47,8 @@ in {
|
|||||||
home.persistence = {
|
home.persistence = {
|
||||||
"/persist/home/${config.home.username}" = {
|
"/persist/home/${config.home.username}" = {
|
||||||
allowOther = true;
|
allowOther = true;
|
||||||
directories = cfg.directories;
|
directories = cfg.directories ++ cfg.cache.directories;
|
||||||
files = cfg.files;
|
files = cfg.files ++ cfg.cache.files;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ let
|
|||||||
|
|
||||||
# Create a new instance of nixpkgs with emacs-overlay applied. This is a
|
# Create a new instance of nixpkgs with emacs-overlay applied. This is a
|
||||||
# little unorthodox, but we do it
|
# little unorthodox, but we do it
|
||||||
# 1. for the sake of organisation — For pure aesthetics and a clean codebase, I want
|
# 1. for the sake of organisation — For pure aesthetics and a clean
|
||||||
# everything Emacs to stay in this file;
|
# 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
|
# 2. and, there's simply no need to leak emacs-overlay's packages into the
|
||||||
# global nixpkgs instance when nothing else is using it!
|
# global nixpkgs instance when nothing else is using it!
|
||||||
pkgs' = import inputs.nixpkgs {
|
pkgs' = import inputs.nixpkgs {
|
||||||
@@ -26,20 +26,32 @@ let
|
|||||||
overlays = [ emacs-overlay ];
|
overlays = [ emacs-overlay ];
|
||||||
};
|
};
|
||||||
|
|
||||||
my-emacs = pkgs'.emacsWithPackagesFromUsePackage {
|
straightBaseDir = "${config.xdg.dataHome}/straight";
|
||||||
config = ./emacs/init.el;
|
|
||||||
defaultInitFile = false;
|
emacsWrapper = pkgs.symlinkJoin {
|
||||||
package = emacsPackage;
|
name = "emacs-wrapper";
|
||||||
alwaysEnsure = true;
|
paths = [ emacsPackage ];
|
||||||
};
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
in {
|
postBuild = ''
|
||||||
programs.emacs = {
|
for i in $out/bin/emacs-*; do
|
||||||
enable = true;
|
wrapProgram "$i" \
|
||||||
package = my-emacs;
|
--add-flags "--init-directory \"${emacsConfigDir}\""
|
||||||
extraConfig = ''
|
done
|
||||||
(load (file-name-concat "${emacsConfigDir}" "init"))
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
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 = {
|
services.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
3
users/crumb/programs/emacs/early-init.el
Normal file
3
users/crumb/programs/emacs/early-init.el
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
;;; early-init.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(setq package-enable-at-startup nil)
|
||||||
@@ -1,6 +1,32 @@
|
|||||||
;; -*- lexical-binding: t; -*-
|
;; -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(require 'use-package-ensure)
|
(defvar bootstrap-version)
|
||||||
(setq use-package-always-ensure t)
|
|
||||||
|
|
||||||
(use-package evil)
|
(setq straight-base-dir
|
||||||
|
(or (getenv "EMACS_STRAIGHT_BASE_DIR")
|
||||||
|
(error "Cannot initialise straight: $EMACS_STRAIGHT_BASE_DIR is undefined!")))
|
||||||
|
|
||||||
|
(let ((bootstrap-file
|
||||||
|
(file-name-concat straight-base-dir
|
||||||
|
"repos/straight.el/bootstrap.el"))
|
||||||
|
(bootstrap-version 7))
|
||||||
|
(unless (file-exists-p bootstrap-file)
|
||||||
|
(let* ((url "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el")
|
||||||
|
(url-buffer (url-retrieve-synchronously
|
||||||
|
url 'silent 'inhibit-cookies)))
|
||||||
|
(with-current-buffer url-buffer
|
||||||
|
(goto-char (point-max))
|
||||||
|
(eval-print-last-sexp))))
|
||||||
|
(load bootstrap-file nil 'nomessage))
|
||||||
|
|
||||||
|
(setq straight-use-package-by-default t)
|
||||||
|
|
||||||
|
(use-package evil
|
||||||
|
:init
|
||||||
|
(setq evil-want-minibuffer t)
|
||||||
|
:config
|
||||||
|
(evil-mode 1))
|
||||||
|
|
||||||
|
(use-package which-key
|
||||||
|
:config
|
||||||
|
(which-key-mode 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user