diff --git a/default.nix b/default.nix index 352c7573..9c652515 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,8 @@ { lib, stdenv, - trivialBuild, + buildElispPackage, + elispInputs, emacs-all-the-icons-fonts, emacsPackages, iosevka-bin, @@ -11,41 +12,36 @@ let tree-sitter = emacsPackages.treesit-grammars.with-all-grammars; - init = trivialBuild { - pname = "config-init"; - version = "1"; + init = buildElispPackage { + ename = "config-init"; src = lib.sourceByRegex ./. [ "init.org" ]; + files = [ "init.org" ]; + lispFiles = [ + "early-init.el" + "init.el" + ]; + + inherit elispInputs; + nativeCompileAhead = true; + wantExtraOutputs = false; + errorOnWarn = true; + doTangle = false; preBuild = '' + export HOME="$NIX_BUILD_TOP/.home" + mkdir -p "$HOME/.config/emacs" + emacs --batch --quick \ --load org \ *.org \ --funcall org-babel-tangle - ''; - - buildPhase = '' - runHook preBuild - - export HOME="$(mktemp -d)" + rm *.org - mkdir -p "$HOME/.emacs.d" - ln -s ${tree-sitter}/lib "$HOME/.emacs.d/tree-sitter" - - emacs --batch --quick \ - --eval '(setq byte-compile-error-on-warn t)' \ - --funcall batch-byte-compile \ - *.el - - runHook postBuild + ln -s ${tree-sitter}/lib "$HOME/.config/emacs/tree-sitter" ''; - # Temporary hack because the Emacs native load path is not respected. - fixupPhase = '' - if [ -d "$HOME/.emacs.d/eln-cache" ]; then - mv $HOME/.emacs.d/eln-cache/* $out/share/emacs/native-lisp - fi - ''; + meta = { }; }; in stdenv.mkDerivation { diff --git a/flake.nix b/flake.nix index 563c3d87..0925f8a4 100644 --- a/flake.nix +++ b/flake.nix @@ -89,11 +89,14 @@ ); emacs-config = prev.callPackage inputs.self { - trivialBuild = final.emacsPackages.trivialBuild.override { - emacs = final.emacs-env.overrideScope ( - _: tprev: { inherit (tprev.emacs) meta withNativeCompilation; } - ); + buildElispPackage = (inputs.twist.lib.buildElispPackage final).override { + emacs = emacsPackage; }; + + elispInputs = prev.lib.pipe final.emacs-env.elispPackages [ + builtins.attrValues + (builtins.filter prev.lib.isDerivation) + ]; }; } ) diff --git a/nix/inputOverrides.nix b/nix/inputOverrides.nix index d63bca40..94a60b03 100644 --- a/nix/inputOverrides.nix +++ b/nix/inputOverrides.nix @@ -1,18 +1,5 @@ { lib, ... }: { - bbdb = _: prev: { - files = - (builtins.removeAttrs prev.files [ - # Unused integrations. - "lisp/bbdb-notmuch.el" - "lisp/bbdb-vm.el" - "lisp/bbdb-vm-aux.el" - ]) - // { - "lisp/bbdb-site.el.in" = "bbdb-site.el.in"; - }; - }; - ghelp = _: prev: { files = builtins.removeAttrs prev.files [ # Unused integrations. diff --git a/nix/packageOverrides.nix b/nix/packageOverrides.nix index 8c307151..ab860d57 100644 --- a/nix/packageOverrides.nix +++ b/nix/packageOverrides.nix @@ -9,16 +9,6 @@ unzip, }: _final: prev: { - bbdb = prev.bbdb.overrideAttrs (old: { - preBuild = '' - substituteInPlace bbdb-site.el.in \ - --replace "@pkgdatadir@" $out/share/emacs/site-lisp/tex/ \ - --replace "@PACKAGE_VERSION@" ${old.version}; - - mv bbdb-site.el{.in,} - ''; - }); - jinx = prev.jinx.overrideAttrs ( old: let