From a4d50421009ab1b310d8fc8054a6e7a184b69738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Vask=C3=B3?= Date: Thu, 2 Jul 2020 20:53:18 +0200 Subject: [PATCH] fixup! override `emacsWithPackages` instead of wrapping it --- default.nix | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/default.nix b/default.nix index dd8ffa6..bb6e1d7 100644 --- a/default.nix +++ b/default.nix @@ -172,17 +172,28 @@ let load-config-from-site ])); in -emacs.overrideAttrs (esuper: { - buildCommand = esuper.buildCommand + '' - for prog in $out/bin/*; do - wrapProgram $out/bin/$(basename $prog) --set DOOMDIR ${doomDir} - done - # emacsWithPackages assumes share/emacs/site-lisp/subdirs.el - # exists, but doesn't pass it along. When home-manager calls - # emacsWithPackages again on this derivation, it fails due to - # a dangling link to subdirs.el. - # https://github.com/NixOS/nixpkgs/issues/66706 - rm -rf $out/share - ln -s ${esuper.emacs}/share $out - ''; -}) +emacs.overrideAttrs (esuper: + let cmd = '' + for prog in $out/bin/*; do + wrapProgram $out/bin/$(basename $prog) --set DOOMDIR ${doomDir} + done + # emacsWithPackages assumes share/emacs/site-lisp/subdirs.el + # exists, but doesn't pass it along. When home-manager calls + # emacsWithPackages again on this derivation, it fails due to + # a dangling link to subdirs.el. + # https://github.com/NixOS/nixpkgs/issues/66706 + rm -rf $out/share + ln -s ${esuper.emacs}/share $out + ''; + in + if esuper ? buildCommand then + { + buildCommand = esuper.buildCommand + cmd; + } + else if esuper ? installPhase then + { + installPhase = esuper.installPhase + cmd; + } + else + abort "emacsWithPackages uses unknown derivation type" +)