One of the reasons I started looking at Nix was to take advantage of pre-built haskell binaries, in particular ghcide.
Now it turns out ghcide is marked broken. I know what to do to fix it (set specific versions on two libs), but I don't know how to get it into a/my nixpkgs properly.
instead of trying to get everything from nixpkgs, you have a Nix expression that evaluates to a derivation that downloads more Nix expressions, then import the result as a Nix expression
I tried just adding ghcide-nix to my list of packages to bring in:
shell-pkgs = with haskellPackages;
[cabal-install
ghcid
ghcide-nix
ormolu];
but that resulted in an error I don't really know what to do with:
error: cannot coerce a set to a string, at /nix/store/3abw7pkjmf850s048q45i203vj9z3czd-nixpkgs-20.03pre203317.8bb98968edf/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix:311:9
(use '--show-trace' to show detailed location information)
ghcide-nix, is a set because you use {} at the end of import, while shell-pkgs, requires a list of string. So maybe you can find ghcide, inside the set of ghcide-nix?
cannot coerce a function to a string, at /nix/store/3abw7pkjmf850s048q45i203vj9z3czd-nixpkgs-20.03pre203317.8bb98968edf/nixpkgs/pkgs/development/haskell-modules/make-package-set.nix:311:9
It absolutely is. I basically just recommend reading Nix Pills, reading the bits of the manual about the particular languages you use, and then stealing everything else from other people. Basically how I learned Emacs
Already read Nix Pills, and the bits on Haskell in the Nix/Nixpkgs manual too. That didn't help much in working out how that particular derivation works though.
I just wish there was some description on how to work things out on my own, stuff like how to visualize a derivation (with some limit on depth) would help immensely when trying to understand something.
No worries, @Rizary, my frustrations is not at all due to a lack of help, so far you and the rest of the Nix community I've interacted with has been wonderfully helpful. My frustration comes more from my inability to work things out myself and having to ask so many questions.
One of the reasons I started looking at Nix was to take advantage of pre-built haskell binaries, in particular ghcide.
Now it turns out ghcide is marked broken. I know what to do to fix it (set specific versions on two libs), but I don't know how to get it into a/my
nixpkgs
properly.Any pointers!
@Magnus Therning I generally get
ghcide
from https://github.com/hercules-ci/ghcide-nixthe general pattern is called "IFD" (import from derivation)
instead of trying to get everything from nixpkgs, you have a Nix expression that evaluates to a derivation that downloads more Nix expressions, then import the result as a Nix expression
Yes, I get the idea, but find the instructions in that repo a bit lacking.. what do I put in my
shell.nix
to get ghcide in my shell?I import it using something like
I tried just adding
ghcide-nix
to my list of packages to bring in:but that resulted in an error I don't really know what to do with:
I'm guessing the added import isn't a derivation?
ghcide-nix = import (builtins.fetchGit {
name = "ghcide-nix";
url = https://github.com/hercules-ci/ghcide-nix;
rev = "4f3e98f211f34698805eb7a3c5f7b4361d97f541";
}) {};
ghcide-nix, is a set because you use {} at the end of import, while shell-pkgs, requires a list of string. So maybe you can find ghcide, inside the set of ghcide-nix?
Ah, is that what the
{}
at the end does. I'll have to try it.If someone would write a guide on how to do introspection in Nix I'd be very happy :grinning_face_with_smiling_eyes:
Without the
{}
I instead getI'm lost :disappointed:
There's a function called
unmarkBroken
underhaskell.lib
. Example here: https://github.com/jhenahan/dotnix/blob/master/overlays/haskell.nix#L37It looks like you'd want to put
ghcide-nixpkgs.<some version>
as listed here: https://github.com/hercules-ci/ghcide-nix/blob/master/nix/default.nixLike this one https://github.com/hercules-ci/ghcide-nix/blob/4f3e98f211f34698805eb7a3c5f7b4361d97f541/nix/default.nix#L27
So
ghcide-nix.ghcide-ghc865
@Magnus Therning What @Jack Henahan said. The README has an example of how to access a derivation representing ghcide for ghc 8.6.5:
Yes, indeed. However, working that out of the source wasn't very easy at all.
I have to admit that, as an absolute beginner at Nix, I find that example completely impenetrable.
It absolutely is. I basically just recommend reading Nix Pills, reading the bits of the manual about the particular languages you use, and then stealing everything else from other people. Basically how I learned Emacs
Reading Matthew Bauer's blog helps, too (matthewbauer.us)
Already read Nix Pills, and the bits on Haskell in the Nix/Nixpkgs manual too. That didn't help much in working out how that particular derivation works though.
I just wish there was some description on how to work things out on my own, stuff like how to visualize a derivation (with some limit on depth) would help immensely when trying to understand something.
I am sorry that I couldn't explain it in detail. But I think others have replied with the answer. Did you finally able to build it?
No worries, @Rizary, my frustrations is not at all due to a lack of help, so far you and the rest of the Nix community I've interacted with has been wonderfully helpful. My frustration comes more from my inability to work things out myself and having to ask so many questions.
Yes I did get it to build.