Installing nix-mode on NixOS fails with a build failure. I have the following nix expression in a flake, based on github:NixOS/nixpkgs/nixos-24.11.
((pkgs.emacsPackagesFor pkgs.emacs29-gtk3).emacsWithPackages (epkgs: [
epkgs.elpaPackages.nix-mode])
It fails with
$ nix log /nix/store/zllvc5zgycrhgb0xgsrc13jhj6frww8y-emacs-nix-mode-1.5.0.drv
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
no configure script, doing nothing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
no Makefile or custom buildPhase, doing nothing
Running phase: installPhase
@nix { "action": "setPhase", "phase": "installPhase" }
Parsing tar file...
Parsing tar file...done
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
INFO Scraping files for loaddefs...
INFO Scraping files for loaddefs...done
GEN nix-mode-autoloads.el
Checking /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0...
Compiling /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-build.el...
Compiling /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el...
Error: file-missing ("Cannot open load file" "No such file or directory" "company")
mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x9baa864b5aef1bf>))
debug-early-backtrace()
debug-early(error (file-missing "Cannot open load file" "No such file or directory" "company"))
require(company)
byte-compile-file-form-require((require 'company))
byte-compile-file-form((require 'company))
#((require 'company))
byte-compile-recurse-toplevel((require 'company) #)
byte-compile-toplevel-file-form((require 'company))
#(#<buffer Compiler Input>)
byte-compile-from-buffer(#<buffer Compiler Input>)
byte-compile-file("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el")
byte-recompile-file("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el" t 0)
#f(compiled-function () #<bytecode -0x7e610aa33e9bc77>)()
byte-recompile-directory("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0" 0 t)
package--compile(#s(package-desc :name nix-mode :version (1 5 0) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1)) (magit-section (0)) (tra>
package-unpack(#s(package-desc :name nix-mode :version (1 5 0) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1)) (magit-section (0)) (trans>
(let ((pkg-desc (if (derived-mode-p 'tar-mode) (package-tar-file-info) (package-buffer-info)))) (package-unpack pkg-desc) pkg-desc)
elpa2nix-install-from-buffer()
(progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer))
(unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-b>
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-ta>
(let ((temp-buffer (generate-new-buffer " temp" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents>
(let ((is-tar (string-match "\.tar\'" file))) (let ((temp-buffer (generate-new-buffer " temp" t))) (save-current-buffer (set-buffer temp-buffer) (unwind>
elpa2nix-install-file("/nix/store/78bzpiffw3dvhy46c11gnyvpplnni6jc-nix-mode-1.5.0.tar")
(progn (setq package-user-dir elpa) (elpa2nix-install-file archive))
(let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive)))
(if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))))
(let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive>
(if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-insta>
(let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null>
(if (consp command-line-args-left) (let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe>
elpa2nix-install-package()
command-line-1(("-l" "/nix/store/cb1mazp6yhvrhlwhr231l8z32s8ys2wh-elpa2nix.el" "-f" "elpa2nix-install-package" "/nix/store/78bzpiffw3dvhy46c11gnyvpplnni6jc->
command-line()
normal-top-level()
Cannot open load file: No such file or directory, company
One can workaround this issue by installing it from MELPA stable which I avoid by my personal policy.
This #89 (comment) comment explains that nix-company.el is excluded from the MELPA build. Is nix-company now part of the release or not? The ELPA build should depend on company or make it a runtime dependency only.
Installing nix-mode on NixOS fails with a build failure. I have the following nix expression in a flake, based on github:NixOS/nixpkgs/nixos-24.11.
It fails with
$ nix log /nix/store/zllvc5zgycrhgb0xgsrc13jhj6frww8y-emacs-nix-mode-1.5.0.drv
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
no configure script, doing nothing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
no Makefile or custom buildPhase, doing nothing
Running phase: installPhase
@nix { "action": "setPhase", "phase": "installPhase" }
Parsing tar file...
Parsing tar file...done
Parsing tar file...
Parsing tar file...done
Extracting... \
Extracting...done
INFO Scraping files for loaddefs...
INFO Scraping files for loaddefs...done
GEN nix-mode-autoloads.el
Checking /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0...
Compiling /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-build.el...
Compiling /nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el...
Error: file-missing ("Cannot open load file" "No such file or directory" "company")
mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 0x9baa864b5aef1bf>))
debug-early-backtrace()
debug-early(error (file-missing "Cannot open load file" "No such file or directory" "company"))
require(company)
byte-compile-file-form-require((require 'company))
byte-compile-file-form((require 'company))
#((require 'company))
byte-compile-recurse-toplevel((require 'company) #)
byte-compile-toplevel-file-form((require 'company))
#(#<buffer Compiler Input>)
byte-compile-from-buffer(#<buffer Compiler Input>)
byte-compile-file("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el")
byte-recompile-file("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0/nix-company.el" t 0)
#f(compiled-function () #<bytecode -0x7e610aa33e9bc77>)()
byte-recompile-directory("/nix/store/p7mdavrhh273ir3ab6psr77bnd2lr4kn-emacs-nix-mode-1.5.0/share/emacs/site-lisp/elpa/nix-mode-1.5.0" 0 t)
package--compile(#s(package-desc :name nix-mode :version (1 5 0) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1)) (magit-section (0)) (tra>
package-unpack(#s(package-desc :name nix-mode :version (1 5 0) :summary "Major mode for editing .nix files" :reqs ((emacs (25 1)) (magit-section (0)) (trans>
(let ((pkg-desc (if (derived-mode-p 'tar-mode) (package-tar-file-info) (package-buffer-info)))) (package-unpack pkg-desc) pkg-desc)
elpa2nix-install-from-buffer()
(progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-buffer))
(unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-tar (progn (tar-mode))) (elpa2nix-install-from-b>
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents-literally file) (insert-file-contents file)) (if is-ta>
(let ((temp-buffer (generate-new-buffer " temp" t))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if is-tar (insert-file-contents>
(let ((is-tar (string-match "\.tar\'" file))) (let ((temp-buffer (generate-new-buffer " temp" t))) (save-current-buffer (set-buffer temp-buffer) (unwind>
elpa2nix-install-file("/nix/store/78bzpiffw3dvhy46c11gnyvpplnni6jc-nix-mode-1.5.0.tar")
(progn (setq package-user-dir elpa) (elpa2nix-install-file archive))
(let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive)))
(if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive))))
(let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-install-file archive>
(if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null x3) (let ((archive x0) (elpa x2)) (progn (setq package-user-dir elpa) (elpa2nix-insta>
(let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe x1)) (x3 (cdr-safe x1))) (if (null>
(if (consp command-line-args-left) (let* ((x0 (car-safe command-line-args-left)) (x1 (cdr-safe command-line-args-left))) (if (consp x1) (let* ((x2 (car-safe>
elpa2nix-install-package()
command-line-1(("-l" "/nix/store/cb1mazp6yhvrhlwhr231l8z32s8ys2wh-elpa2nix.el" "-f" "elpa2nix-install-package" "/nix/store/78bzpiffw3dvhy46c11gnyvpplnni6jc->
command-line()
normal-top-level()
Cannot open load file: No such file or directory, company
One can workaround this issue by installing it from MELPA stable which I avoid by my personal policy.
This #89 (comment) comment explains that nix-company.el is excluded from the MELPA build. Is nix-company now part of the release or not? The ELPA build should depend on company or make it a runtime dependency only.