From 1ce431b0e5d02bf39546c7e3a124b781b42a616c Mon Sep 17 00:00:00 2001 From: John Ogle Date: Mon, 16 Dec 2024 11:03:16 -0800 Subject: [PATCH] [emacs] Use external module for doom config --- flake.lock | 203 +++++++++++++++++++++++++++++++-- flake.nix | 10 +- home/modules/emacs/default.nix | 47 +------- 3 files changed, 208 insertions(+), 52 deletions(-) diff --git a/flake.lock b/flake.lock index 161f9d5..a85bebe 100644 --- a/flake.lock +++ b/flake.lock @@ -1,8 +1,86 @@ { "nodes": { + "chaotic": { + "inputs": { + "flake-schemas": "flake-schemas", + "home-manager": "home-manager", + "jovian": "jovian", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733839340, + "narHash": "sha256-aaA0XSnlqpjjMdJoQFc8knMStn3/kXxVLs3z2erhmNI=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "d3a3a98545d2ba55affa97e189e8f98b43e9da70", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "doomemacs": { + "flake": false, + "locked": { + "lastModified": 1733434763, + "narHash": "sha256-sebujw5VvBWMS+wXyjiGF81iyjPM/QQDnw5l7tDJCvk=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "ba1dca322f9a07bc2b7bec6a98f2c3c55c0bbd77", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "type": "github" + } + }, + "emacs-overlay": { + "inputs": { + "nixpkgs": [ + "nix-doom-emacs-unstraightened" + ], + "nixpkgs-stable": [ + "nix-doom-emacs-unstraightened" + ] + }, + "locked": { + "lastModified": 1734315266, + "narHash": "sha256-k6ekQwIK/TASoPwTyeY2JiBHzwmPZSLGrYNXF+fLhC8=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "fce2b6224adae5f9b6d43d74ecb996a3133a63f4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" + } + }, "home-manager": { "inputs": { "nixpkgs": [ + "chaotic", "nixpkgs" ] }, @@ -20,13 +98,101 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733873195, + "narHash": "sha256-dTosiZ3sZ/NKoLKQ++v8nZdEHya0eTNEsaizNp+MUPM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "f26aa4b76fb7606127032d33ac73d7d507d82758", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1733491721, + "narHash": "sha256-n4fTKTYXeGRngeanNDxSxbuWSRCQ6l74IwOBlqp8dcw=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "0f415721ee427270bc078ef3a5ba2a308d47461f", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "nix-doom-emacs-unstraightened": { + "inputs": { + "doomemacs": "doomemacs", + "emacs-overlay": "emacs-overlay", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1734338553, + "narHash": "sha256-KEuh2nsgl8iiPWMg4wfrnCoZqPssw6dbMCy9MheLJZg=", + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "rev": "728040b0b7c2c0baa47fb3365b57bd3e1658207a", + "type": "github" + }, + "original": { + "owner": "marienz", + "repo": "nix-doom-emacs-unstraightened", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1733392399, - "narHash": "sha256-kEsTJTUQfQFIJOcLYFt/RvNxIK653ZkTBIs4DG+cBns=", + "lastModified": 1733759999, + "narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d0797a04b81caeae77bcff10a9dde78bc17f5661", + "rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56", "type": "github" }, "original": { @@ -46,11 +212,11 @@ ] }, "locked": { - "lastModified": 1733410572, - "narHash": "sha256-XkMZGeqg0GCRoSXvMcaHP7bdvWPRZxCK1sw1ASsc16E=", + "lastModified": 1733858086, + "narHash": "sha256-h2BDIDKiqgMpA6E+mu0RgMGy3FeM6k+EuJ9xgOQ1+zw=", "owner": "nix-community", "repo": "plasma-manager", - "rev": "92721d7402526599366d00e242813798e9914970", + "rev": "7e2010249529931a3848054d5ff0dbf24675ab68", "type": "github" }, "original": { @@ -61,7 +227,9 @@ }, "root": { "inputs": { - "home-manager": "home-manager", + "chaotic": "chaotic", + "home-manager": "home-manager_2", + "nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened", "nixpkgs": "nixpkgs", "plasma-manager": "plasma-manager", "sops-nix": "sops-nix" @@ -74,11 +242,11 @@ ] }, "locked": { - "lastModified": 1733128155, - "narHash": "sha256-m6/qwJAJYcidGMEdLqjKzRIjapK4nUfMq7rDCTmZajc=", + "lastModified": 1733785344, + "narHash": "sha256-pm4cfEcPXripE36PYCl0A2Tu5ruwHEvTee+HzNk+SQE=", "owner": "Mic92", "repo": "sops-nix", - "rev": "c6134b6fff6bda95a1ac872a2a9d5f32e3c37856", + "rev": "a80af8929781b5fe92ddb8ae52e9027fae780d2a", "type": "github" }, "original": { @@ -86,6 +254,21 @@ "repo": "sops-nix", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 4250fa1..029ab06 100644 --- a/flake.nix +++ b/flake.nix @@ -19,6 +19,11 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.follows = "home-manager"; }; + + nix-doom-emacs-unstraightened = { + url = "github:marienz/nix-doom-emacs-unstraightened"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { self, nixpkgs, ... } @ inputs: let @@ -29,7 +34,10 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.sharedModules = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; + home-manager.sharedModules = [ + inputs.plasma-manager.homeManagerModules.plasma-manager + inputs.nix-doom-emacs-unstraightened.hmModule + ]; } ]; in { diff --git a/home/modules/emacs/default.nix b/home/modules/emacs/default.nix index e985f70..2a0b218 100644 --- a/home/modules/emacs/default.nix +++ b/home/modules/emacs/default.nix @@ -2,14 +2,7 @@ with lib; -let - doomSync = (let - git = pkgs.git; - in '' - export PATH=${pkgs.emacs}/bin:${git}/bin:$PATH - ${config.xdg.configHome}/emacs/bin/doom sync -u -j $((`nproc`/4*3)) - ''); -in { +{ config = { home.packages = [ pkgs.emacs-all-the-icons-fonts @@ -26,43 +19,15 @@ in { pkgs.python3 ]; + programs.doom-emacs = { + enable = true; + doomDir = ./doom; + }; + fonts.fontconfig.enable = true; - home.file = { - ".config/emacs" = { - source = fetchGit { - url = "https://github.com/doomemacs/doomemacs.git"; - # When updating me, remember to run `doom sync` - rev = "f425f2ff3da584cfe2676f6b9cf1d81a690a75e5"; - }; - # We need to use recursive mode here or else doom fails to sync for - # some reason related to the permissions on the synced path. I'm not - # quite sure of everything that's going on here. - recursive = true; - - # Because `recursive = true` will cause this to sync every single - # activation, we turn this off here. - # - # There's probably a way we could do better detection of this within - # our onChange shell? - # - # onChange = doomSync; - }; - }; - home.sessionVariables = { - DOOMLOCALDIR = "${config.xdg.dataHome}/doom"; EDITOR = "emacs -nw"; }; - - home.sessionPath = [ - "${config.xdg.configHome}/emacs/bin" - ]; - - xdg.configFile."doom" = { - source = ./doom; - # Sync doom if we updated the config - onChange = doomSync; - }; }; }