Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

intero-nix-shim: init at 0.1.0 #24853

Merged
merged 1 commit into from May 3, 2017
Merged

Conversation

michalrus
Copy link
Member

Motivation for this change

Currently, there is no way to use Intero (Haskell IDE in Emacs) with Nix-based Haskell projects, you have to use Stack for managing your projects. This small package can be used in place of Stack, making Intero work with pure Haskell/Nix projects.

Things done
  • Tested using sandboxing
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

/cc @shlevy =)

@mention-bot
Copy link

@michalrus, thanks for your PR! By analyzing the history of the files in this pull request, we identified @peti, @mdorman and @pikajude to be potential reviewers.

intero-nix-shim = import (pkgs.fetchFromGitHub {
owner = "michalrus";
repo = "intero-nix-shim";
rev = "5b3fc9aa8900ca635467b6e8f5597161303eff33";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use a tag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@michalrus
Copy link
Member Author

michalrus commented Apr 12, 2017

@shlevy, here’s a first sketch of the README → https://github.com/michalrus/intero-nix-shim#readme

It feels too complicated. :/

@shlevy
Copy link
Member

shlevy commented Apr 12, 2017

@michalrus So does intero-nix-shim just call out to ghc in $PATH?

@michalrus
Copy link
Member Author

I’ve been wondering about that, but finally decided to do:

https://github.com/michalrus/intero-nix-shim/blob/520c73fce1dee7bf0cc3fd007c636eda538b4d91/src/Main.hs#L30-L37

So ghci is cabal repl. Any other exec is run via cabal exec (including ghc, see below for command-line args parsing). There are two more commands needed, one returning project’s root dir, and another with its compilation targets.

@michalrus
Copy link
Member Author

Feel free to change anything in that initial sketch, I’ve just given you RW access, but it works for me. ^_^

@shlevy
Copy link
Member

shlevy commented Apr 12, 2017

Hmm... I don't know if I love that. What if I don't have cabal-install?

@michalrus
Copy link
Member Author

michalrus commented Apr 12, 2017

Me neither, but then it would be really hard to determine GHCi’s (Intero’s) real arguments. :(

Cabal adds a lot. Once intero is running, you can see that in htop or ps or …

We’d need to duplicate their work to determine them.

@shlevy
Copy link
Member

shlevy commented Apr 12, 2017

Can we hard-code a reference to cabal-install into intero-nix-shim?

@michalrus
Copy link
Member Author

michalrus commented Apr 12, 2017

Nice idea! But it’d also be desirable to hard-code intero itself, right?

It would simplify users’ default.nixes. =]

@shlevy
Copy link
Member

shlevy commented Apr 12, 2017

Yep!

@michalrus
Copy link
Member Author

I’m on it!

@shlevy
Copy link
Member

shlevy commented Apr 12, 2017

BTW, it may be interesting to look at intero-nix-shim-with-packages that doesn't have to rebuild a cabal dist dir in-tree

@michalrus
Copy link
Member Author

michalrus commented Apr 13, 2017

@shlevy, paths symlinked to libexec/{cabal,intero} and hardcoded. =)

Also, the README is updated accordingly. It’s simpler now! https://github.com/michalrus/intero-nix-shim#readme

@michalrus
Copy link
Member Author

I might need some help with that first build job failing… =( The other two are 🍏 .

@shlevy
Copy link
Member

shlevy commented Apr 13, 2017

Which build job?

@michalrus
Copy link
Member Author

This PR on Travis → https://travis-ci.org/NixOS/nixpkgs/builds/221563087

@shlevy
Copy link
Member

shlevy commented Apr 13, 2017

Oh, travis is pure noise.

@shlevy
Copy link
Member

shlevy commented Apr 13, 2017

@peti any objection here?

@peti
Copy link
Member

peti commented Apr 13, 2017

Do we really need import-from-derivation here? This feature has several unpleasant side-effects in Nix/Hydra today and I'd rather not use it for a package that Hydra is going to discover and build.

@shlevy
Copy link
Member

shlevy commented Apr 13, 2017

Ah, missed that. @michalrus Can you check in the cabal2nix expr?

@michalrus
Copy link
Member Author

michalrus commented Apr 13, 2017

Sure, whatever is necessary! I just didn’t want to commit auto-generated code, but if it’s needed, sure.

Where should I put it? Or… should I splice it straight into configuration-common.nix?

Could you point me to some issues/docs to read about these side effects? This seems interesting.

@shlevy
Copy link
Member

shlevy commented Apr 13, 2017

@peti any preference for where it should live?

@michalrus
Copy link
Member Author

(I’ll be offline for a few days, so if we don’t finish today, and you want it finished today/tomorrow, don’t hesitate to take this over :) ).

@michalrus
Copy link
Member Author

Bump. =]

@shlevy
Copy link
Member

shlevy commented Apr 18, 2017

@peti ping? @michalrus I'll find a place for it in a few days if there's nothing from @peti

@michalrus
Copy link
Member Author

@shlevy, thank you! 🙇‍♂️ In the meantime, I modified README not to disorient users.

@shlevy
Copy link
Member

shlevy commented Apr 24, 2017

@michalrus Can you just create an intero-nix-shim.nix here with the cabal2nix results?

@michalrus
Copy link
Member Author

michalrus commented May 3, 2017

@shlevy, is this better? =) I followed the ../tools/haskell/ approach from Haste/Tinc in that same file.

@shlevy shlevy merged commit 9925c5c into NixOS:master May 3, 2017
@michalrus michalrus deleted the intero-nix-shim branch May 3, 2017 22:00
@michalrus
Copy link
Member Author

Thank you! :)

@shlevy
Copy link
Member

shlevy commented May 3, 2017

Cherry-picked onto 17.03: a162c6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants