I trying to use utop from nix-shellenvironment in Emacs.
I run it like nix-shell--pure --quiet --run 'opam config exec -- dune utop . -- -emacs' $PROJECT_ROOT/shell.nix and it work in plain shell. But when I start M-x utop, I get Process utop exited with code 1. Have no idea how to debug it.
My configuration:
.dir-locals.el:
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((nil . ((eval . (progn
(setq utop-command
(let ((project-root
(or (when (require 'projectile)
(projectile-project-root))
(file-name-directory
(let ((d (dir-locals-find-file
".")))
(if (stringp d) d (car d))))
(pwd))))
(format "nix-shell $NIX_ARGS --pure --quiet --run 'opam config exec -- dune utop . -- -emacs' %sshell.nix"
project-root))))))))
shell.nix:
with import <nixpkgs> {};
let
sandbox-exec = stdenv.mkDerivation {
name = "sandbox-exec";
src = /usr/bin/sandbox-exec;
unpackPhase = "true";
buildPhase = "true";
installPhase = "mkdir -p $out/bin && ln -s $src $out/bin/sandbox-exec";
};
in
stdenv.mkDerivation {
name = "develop";
src = if lib.inNixShell then null else ./.;
shellHook = ''
eval `opam env -y`
'';
buildInputs = with ocaml-ng.ocamlPackages_4_05; [
opam
ocaml
dune
ocamlformat
utop
odoc
merlin
ocp-indent
gmp
coreutils
cacert
gnupg
fswatch
m4
pkg-config
perl
less
which
tree
ripgrep
gitMinimal
ncurses
] ++ stdenv.lib.optional stdenv.isDarwin sandbox-exec;
}
I trying to use
utop
fromnix-shell
environment in Emacs.I run it like
nix-shell--pure --quiet --run 'opam config exec -- dune utop . -- -emacs' $PROJECT_ROOT/shell.nix
and it work in plain shell. But when I startM-x utop
, I getProcess utop exited with code 1
. Have no idea how to debug it.My configuration:
.dir-locals.el
:shell.nix
: