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

Bash error is thrown with (direnv+nix-direnv+emacs-direnv) setup, when I try to build ghc using ghc.nix? #98

Open
zeta-00 opened this issue Feb 7, 2021 · 3 comments

Comments

@zeta-00
Copy link

zeta-00 commented Feb 7, 2021

Hello there, again I'm trying to build ghc in an isolated environment using ghc.nix, but my (direnv+nix-direnv+emacs-direnv) setup is causing an error to be thrown. I fixed the hadrian.cabal file not found error by just moving my shell.nix up one directory into the ghc repository, but the bash error still remains?
Here's the pastebin:

trace: checking if /home/zeta/open-source-projects/haskell-projects/ghc/hadrian/hadrian.cabal is present: yes
bash: /nix/store/hl4m94j3yl7v5jfpn2kq0rkvj5kj428b-ghc-8.8.4-with-packages: Is a directory

And here is the shell.nix that file that I placed with a .envrc file inside the ghc repository root directory(I renamed the default.nix file to ghc-build.nix):

{ pkgs ? import {}}:

let
ghc-build = import ./ghc.nix/ghc-build.nix {};
in
pkgs.mkShell
{
nativeBuildInputs = with pkgs;
[
ghc-build
];
}

Thanks in advance for the help!

@supersven
Copy link
Collaborator

Hey @zeta-00 ,

{ pkgs ? import {}}: looks wrong. 🤔

I think you need to define what you want to import (e.g. <nixpkgs>).

IMHO it's idiomatic, that the shell.nix file resides on the top-level of the project.

I propose these steps (in order):

  • Make sure that your shell.nix works. It should work without moving or tweaking any other files.
  • Make direnv work with this shell.nix on the command line. Test it on the command line.
  • Now you can wire it in the Emacs configuration.

@supersven
Copy link
Collaborator

supersven commented Feb 7, 2021

Have you seen https://gitlab.haskell.org/ghc/ghc/-/wikis/spacemacs ?

It's a bit outdated* (regarding ghcide -> haskell language server), but maybe you get an impression how I used ghc.nix with Emacs about a year ago.


  • I don't use Emacs for GHC development anymore, so contributions / updates to this page are very welcome.

@zeta-00
Copy link
Author

zeta-00 commented Feb 7, 2021

@supersven ,

Hello there,
Thanks for the response, my (direnv+nix-direnv+emacs-direnv) setup works great for most small projects that I work on. I think my main issue is, slightly changing ghc.nix's filenames and paths so that it works with my setup. Someone on another issue that I posted here in this repository (#74) said that he got his (direnv+lorri+zsh) setup working out-of-the-box, so I asked him if he could paste his shell.nix code and the extra steps that he did. I think that I'm close to getting this working with my setup, I'm guessing that there's something that I'm missing.

Anyways, thanks again for your response and the link to the documentation, I'll definitely take a look.

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

No branches or pull requests

2 participants