Derivation to install haskell stack from released binaries

Anybody have a derivation to install haskell’s stack tool from the released binaries, rather than by building it?

Along the lines of GitHub - justinwoo/easy-purescript-nix: Easy PureScript (and other tools) with Nix

1 Like

Stack has statically linked binaries available for each release:

https://github.com/commercialhaskell/stack/releases/download/v2.3.0.1/stack-2.3.0.1-linux-x86_64-static-bin

You might be able to just download this and use it? You might not have to go the easy-purescript-nix route and actually patchelf.

Also, I believe at some point (and maybe still) these statically-linked stack binaries were created by @nh2 in GitHub - nh2/static-haskell-nix: easily build most Haskell programs into fully static Linux executables.


I guess the big question is why do you want this? We should always have working stack binaries in nixpkgs, since stack is used by so many Haskellers. These stack binaries should always be built by Hydra, so in general you shouldn’t have to build it yourself.

If you find that stack is not building in the master branch of nixpkgs, please send a PR fixing it up, or at least create an issue and ping me.

Thanks for the reply, and for the links!

I’m on macOS, and yesterday I attempted to install stack, which seemed to download the internet and took a very long time… so I was wondering.

I guess in general I’m not opposed to using binaries released by the developer over building everything locally, unless there are changes to be applied.

I’ll make sure to report if building stack is broken. Thanks again!

Ah, I see. I’ve heard a couple similar reports from people. The MacOSX nixpkgs channel seems to advance before Haskell-related packages have been built and cached by Hydra.

If this is bothering you, can you create an issue on the nixpkgs repo asking for stack to be added as a blocker for the MacOSX nixpkgs channel advancing? I don’t know how this works, but hopefully we can find some MacOSX users that know how to do this and get them to help us with this.

Actually, I was just investigating an unreleated issue, and I figured out how to add stack as a blocker for the darwin channel:

If you remove the comment on that line, you should be able to force the darwin channel to build and cache stack before advancing.

1 Like

This also has the effect that a broken stack build will prevent the entire nixos-unstable channel from advancing. Is that something we want? Especially considering how volatile stack is?

I think this is a good question.

In the past couple months that I’ve been helping with Haskell-related stuff in nixpkgs, it seems like stack has been working for the majority of the time. It is occasionally annoying to get working, but given that it is used by so many Haskellers, I think it is nice to keep it always working.

However, I’m not sure of any rules around what sort of things are considered blockers for the unstable channels. Does it even make any sense to have a build tool for programming language as a blocker? I can certainly understand having things like gcc, llvm, bash, etc as blockers, but stack?

Before we add stack as a blocker, it would be a good idea to see if there are any other tools from other programming languages that are also blockers. If so, then maybe we could also add stack as a blocker? If not, then maybe it doesn’t make sense to have an exception just for stack.

Although, like I said above, I’ve heard quite a few reports from people using the darwin channel complaining that they end up having to build a bunch of Haskell stuff instead of being able to get it from the cache. Maybe there is some other way to solve this problem?