jyp / dante

391 stars 51 forks source link

Unable to get dante working with SimulaVR #161

Closed georgewsinger closed 4 years ago

georgewsinger commented 4 years ago

I am trying to get SimulaVR (nix-based Haskell project) working with dante. I am able to get a REPL working outside of dante as follows:

nix-env -i cabal-install
git clone --recursive https://github.com/SimulaVR/Simula

cd ./Simula/addons/godot-haskell-plugin # <- Haskell project root
nix-shell --attr env default.nix
cabal repl

However, when I launch dante in Spacemacs and run dante-type-at on a Haskell symbol:

---

This is the buffer associated with the GHCi session. This buffer
is normally hidden, but the GHCi process ended.

WHAT TO DO NEXT

Verify that the GHCi REPL can be loaded manually, then try to
customize (probably file-locally or directory-locally)
`dante-project-root' and/or `dante-repl-command-line'.  If you
fixed the problem, just kill this buffer, Dante will make a fresh
one and attempt to restart GHCi automatically.
If you leave this buffer around Dante will not attempt to restart
GHCi.  You can always run `dante-restart' to make it try again.

EXTRA TROUBLESHOOTING INFO

Process state change: exited abnormally with code 127

default-directory "/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/"
dante-command-line ("/bin/sh" "-i")
dante-state dead
dante-queue (#[257 "r\302\301!\203\0\302\301!q\210\212\301b\210\300!*\207" [#[257 "\211\204\0\300?\205\0\306\307\310\"\304\"\211\303\205\0\211\211\203(\0\307\311\"\301!\262\202i\0\302\211\300\211\312\313\305!\304#\314\315\211\305\315\316%\300\203G\0\317\202H\0\320\321\322\323\324\325\326\300\301\304\305&\327\"\330\331%\"\262\262\262\262\262\262\262\262\207" [nil #[257 "\302\303\301P\304\305\306\307\310\300!\311\"\312\313%\"\210\314 \207" [nil "\"/tmp/tramp.dantedVtylK.hs\" 358 1 358 6 focus" dante-async-call ":type-at " make-byte-code 257 "\300\203\0\212\301 b\210\302!\303\261)\207\304\305\302!\"\207" vconcat vector [line-beginning-position dante-fontify-expression "
" message "%s"] 5 "

(fn TY)" lcr-scheduler] 9 "

(fn LOAD_MESSAGES)"] 1863 nil "/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/src/Plugin/SimulaViewSprite.hs" "/ssh:george@192.168.0.52#22:/tmp/tramp.dantedVtylK.hs" s-equals\? buffer-local-value dante-loaded-file dante-load-message puthash dante-local-name write-region nil 0 ":set -fbyte-code" ":set -fobject-code" dante-async-call make-byte-code 257 "p\211\304q\306\305\203
\0\307\202\0\310\300\203\0\311\202\0\312\313\303!Q!\314\312\315\316\317\320\321\322\301\302#\323\"\324\325%#\262\262\262\207" vconcat vector [dante-async-write ":r" ":l " "*" "" dante-local-name dante-load-loop nil make-byte-code 257 "\211\211G\305U\203\0\211A\262\242\202\0\306\307\310GD\"\211A\262\242@\301\211\266\203\302q\300!\262\262\207" vconcat vector [dante-loaded-file dante-load-message 3 signal wrong-number-of-arguments nil] 7 "

(fn V1591)"] 16 "

(fn V1586)" dante-interpreted dante-temp-epoch dante-original-buffer-map] 23 "

(fn V1578)"] #<marker at 15987 in SimulaViewSprite.hs> marker-buffer] 3 "

(fn BUFFER)"])
dante-loaded-file "<DANTE:NO-FILE-LOADED>"
dante-load-message nil
lcr-process-callback #[257 "\303\304\305\300#\210r\306\302!\203\0\306\302!q\210\212\302b\210\301!*\207" [#<buffer *dante:godot-haskell-plugin::/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/*> #[257 "\302\303\"\210\300\304\305\306#!\210\307\301!\207" [#[257 "\300\242P\300\240\301\304\300\242\"\240\305\302\242!\262\262\207" [("env: ‘nix-shell’: No such file or directory
") (nil) (#[0 "\303\242?\211\203\0\305\306\307\310\311\312\302\303\304#\313\"\314\315%!\202,\0\316\302\242\317\320\224SO!\301q\300!\262\262\207" [#[257 "\300\301!\207" [dante-set-state running] 3 "

(fn START-MESSAGES)"] #<buffer SimulaViewSprite.hs> ("env: ‘nix-shell’: No such file or directory
") (nil) #6 dante-async-read make-byte-code 257 "\300\242P\300\240\301\304\300\242\"\240\305\302\242!\262\262\207" vconcat vector [dante-ghci-prompt string-match lcr-yield] 7 "

(fn V1637)" s-trim-right 0 1] 10]) dante-ghci-prompt string-match lcr-yield] 7 "

(fn V1637)"] #<buffer *dante:godot-haskell-plugin::/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/*> dante-debug inputs s-replace "
" "" dante-schedule-next] 6 "

(fn INPUT)"] #<marker at 1 in *dante:godot-haskell-plugin::/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/*> lcr-set-local lcr-process-callback nil marker-buffer] 5 "

(fn INPUT)"]

I have tried making a .dir-locals.el in directory ./addons/godot-haskell-plugin (the Haskell project root) with

((nil . ((dante-methods . (new-impure-nix)))))

In addition, I have verified that dante-project-root is correctly

"/ssh:george@192.168.0.52#22:/home/george/Simula/addons/godot-haskell-plugin/" # I actually run this project over a local SSH connection, so this is correct

Any advice on how to get dante up and running?

georgewsinger commented 4 years ago

The issue is nix-shell can't be run on my remote host unless/until /home/george/.bashrc is sourced first (on my local machine). dante-start wraps a call to start-file-process, which wraps a call to nix-shell.

I started an issue to figure out how to resolve this: https://emacs.stackexchange.com/questions/61728/how-to-tell-tramp-to-load-bashrc-before-executing-commands-remotely

georgewsinger commented 4 years ago

Using the absolute path of nix-shell and cabal fixed the issue.