diff --git a/README.org b/README.org index adc4d60..9b48cce 100755 --- a/README.org +++ b/README.org @@ -97,7 +97,24 @@ sydnix-cli is a command-line utility written in Clojure wrapping various sydnix- * Tasks -** Emacs +** Begin setting up doomless Emacs + +*** DONE Daemon +CLOSED: [2025-01-03 Fri 20:00] + +*** DONE Mutable config +CLOSED: [2025-01-03 Fri 20:01] + +Path is currently hardcoded to =/persist/dots/users/crumb/programs/emacs=. An immutable file (created by home-manager's =programs.emacs.extraConfig=) loads =init.el= from the hardcoded path. + +*** DONE Packages via Nixpkgs +CLOSED: [2025-01-03 Fri 20:40] + +*** TODO =map!= macro + +*** TODO Module system? + +** Emacs config *** [#A] One-off environment changes without direnv @@ -329,6 +346,10 @@ https://discourse.nixos.org/t/what-to-do-with-a-full-boot-partition/2049 Remove a given host from =~/.ssh/known_hosts=. Something like =sed -i -e '/192.168.122.54/d' .ssh/known_hosts=. +*** TODO =lets-temp [NAME]= + +Create a new tempdir called ~[NAME]~, and cd into it. + * References Following is a subset of the many places I've learnt from. @@ -341,3 +362,5 @@ Following is a subset of the many places I've learnt from. - [cite:@christensen2020erase] - [cite:@ayats2024dropping] - [cite:@zaynetdinov2024you] +- [[https://prelude.emacsredux.com/en/stable/][Emacs Prelude]] +- [[https://github.com/doomemacs/doomemacs][Doom Emacs]] diff --git a/flake.nix b/flake.nix index 393fb73..46afdd4 100755 --- a/flake.nix +++ b/flake.nix @@ -56,4 +56,13 @@ homeConfigurations = import ./outputs/homeConfigurations.nix inputs; }; + + nixConfig = { + extra-substituters = [ + "https://nix-community.cachix.org" + ]; + extra-trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + }; } diff --git a/users/crumb/programs/emacs.nix b/users/crumb/programs/emacs.nix new file mode 100644 index 0000000..672a5bb --- /dev/null +++ b/users/crumb/programs/emacs.nix @@ -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; + }; +} diff --git a/users/crumb/programs/emacs/init.el b/users/crumb/programs/emacs/init.el new file mode 100644 index 0000000..848f08b --- /dev/null +++ b/users/crumb/programs/emacs/init.el @@ -0,0 +1,6 @@ +;; -*- lexical-binding: t; -*- + +(require 'use-package-ensure) +(setq use-package-always-ensure t) + +(use-package evil)