nix-community / emacs-overlay

Bleeding edge emacs overlay [maintainer=@adisbladis]
507 stars 166 forks source link

commercial-emacs fails to build #389

Closed bandithedoge closed 3 months ago

bandithedoge commented 9 months ago
~ took 59s
14:00:28 ERROR 1 ❯ nix build github:nix-community/emacs-overlay#commercial-emacs
do you want to allow configuration setting 'extra-substituters' to be set to 'https://nix-community.cachix.org' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyv
RCYg3Fs=' (y/N)? y
do you want to permanently mark this value as trusted (y/N)? y
error: builder for '/nix/store/jvq40qyaffxmhk7h1ab7jb3r05pbsf2p-commercial-emacs-20240221.0.drv' failed with exit code 1;
       last 27 log lines:
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/b854mq1w4fi4hzz61ybhwbva252d2m56-source
       > source root is source
       > Running phase: patchPhase
       > substituteStream(): WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. (file 'src/Makefile.in')
       > substituteStream(): WARNING: pattern RUN_TEMACS\ =\ ./temacs doesn't match anything in file 'src/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './lisp/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './nextstep/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './oldXMenu/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './lwlib/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './doc/emacs/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './doc/lispref/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './doc/lispintro/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './doc/misc/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './admin/unidata/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './admin/charsets/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './nt/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './lib-src/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './lib/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './leim/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './test/manual/noverlay/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './test/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './test/infra/Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './Makefile.in'
       > substituteStream(): WARNING: pattern /bin/pwd doesn't match anything in file './src/Makefile.in'
       > substitute(): ERROR: file 'lisp/loadup.el' does not exist
       > /nix/store/yq9qag5ak3w15nhcqplnhxpny6295l36-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/jvq40qyaffxmhk7h1ab7jb3r05pbsf2p-commercial-emacs-20240221.0.drv'.
jian-lin commented 8 months ago

This commit replaces --replace with --replace-warn which is not backported to the stable release (NixOS 23.11).

cc @leungbk


edit:

Oops, what I mention above is not relevant to this issue. Anyway, that commit should be reverted.

leungbk commented 8 months ago

This commit replaces --replace with --replace-warn which is not backported to the stable release (NixOS 23.11).

My mistake, I should've confirmed with the stable branch before pushing.

@bandithedoge could you please provide the most recent revision where commercial-emacs worked for you?

The error observed here occurs because lisp/loadup.el does not exist in commercial-emacs. But upon wrapping that only conditionally with

diff --git a/overlays/emacs.nix b/overlays/emacs.nix
index afe0cc8f..da54f4f1 100644
--- a/overlays/emacs.nix
+++ b/overlays/emacs.nix
@@ -33,9 +33,11 @@ let
                                  [ "--enable-check-lisp-object-type" ];

               postPatch = old.postPatch + ''
-                substituteInPlace lisp/loadup.el \
-                --replace '(emacs-repository-get-version)' '"${repoMeta.rev}"' \
-                --replace '(emacs-repository-get-branch)' '"master"'
+                if [ -f "lisp/loadup.el" ]; then
+                    substituteInPlace lisp/loadup.el \
+                    --replace '(emacs-repository-get-version)' '"${repoMeta.rev}"' \
+                    --replace '(emacs-repository-get-branch)' '"master"'
+                fi
               '' +
               # XXX: Maybe remove when emacsLsp updates to use Emacs
               # 29.  We already have logic in upstream Nixpkgs to use
-- 
2.43.0

commercial-emacs still does not build with this patch, and instead segfaults. If provided a revision where this is known to build, I can try to bisect and look into this a bit more.

adisbladis commented 3 months ago

Build failures for git packages are to be expected. Patches welcome.