IHP 1.3 is out now!

Finding compatible libraries/versions with Nix

ratherforky

I'm usually a Stack user who doesn't bother with version bounds or anything like that for personal projects, so I'm used to adding a package to my dependencies and simply letting Stack figure our how to make it work. I tried to do the same thing with Nix and of course ran into issues. Specifically I wanted to use random-fu, so I added it to default.nix and ran make -B .envrc, but it failed to build dependencies. This may just be a random-fu issue and I'm open to other random library suggestions (just need something that randomly chooses an element of a list), but I'd like to know how to deal with this kind of problem in general. Is there a list of packages that definitely work with the rest of ihp? Are there tools similar to Stack's resolver that could be used here?

ratherforky

Oh, and now I can't go back to what I had before using make -B .envrc. I get this error (but I've replaced my long path with $PATH):

which: no RunDevServer in $PATH
dirname: missing operand
Try 'dirname --help' for more information.
Makefile:7: /../lib/IHP/Makefile.dist: No such file or directory
make: *** No rule to make target '/../lib/IHP/Makefile.dist'.  Stop.

The contents of .envrc are:

PATH_add 

Presumably that had more in it before, but I hadn't looked at it so I don't know. How should I fix this and what might be a less dangerous way of including new dependencies in the future?

marc PRO

For the make -B .envrc error take a look at this article in the IHP Wiki: https://github.com/digitallyinduced/ihp/wiki/Troubleshooting#makefile7-libihpmakefiledist-no-such-file-or-directory

Usually updating the package version to the latest version available on hackage fixes the issue. Use the following guide to update the package you want to install: https://ihp.digitallyinduced.com/Guide/package-management.html#using-a-different-version-of-a-haskell-package Does that fix the issue?

ratherforky

I fixed the make -B .envrc error by copying the generated .envrc from a different ihp project. That article doesn't account for if your .envrc is empty because something went wrong generating it unfortunately. Some automated reverting to the previous .envrc if there's an error would be a nice thing to have in this situation, but for now I've manually made a copy I can revert to whenever make -B .envrc fails.

Did the steps in the nix guide, but it took a little more fiddling around to get it working. Had to update a dependency (rvar) to the latest one on hackage and jailbreak random-fu before it worked, but I did get it working in the end, thank you!