Stricter than stack on separating HaskellDepends and SystemDepends
Closed this issue · 3 comments
This could possibly be an issue with posix-pty rather than stack2nix, but the fact is that stack builds this and stack2nix doesn't.
- Check out https://github.com/cryptiumlabs/backerei d94cfed6b002d4400b8d727a1f9773a9bbc979d4 .
- Build with
stack build
, works. - Generate
s2n.nix
withstack2nix
8efe2d4 . - Build with
nix-build s2n.nix -A backerei
, get:
error: attribute 'util' missing, at /home/clacke/git/fractalide/asdf/backerei/s2n.nix:27059:14
posix-pty adds util
in Extra-Libraries
:
https://bitbucket.org/merijnv/posix-pty/src/00102b522ab61442b997561121233d20fc3c0aed/posix-pty.cabal
I have no experience with Haskell and Cabal, and the documentation is pretty fuzzy on what goes in that field, a "library". But it seems that the posix-pty author thinks its a Haskell library, but stack2nix considers it a field for system libraries.
cabal2nix doesn't distinguish these things either, so posix-pty can be compiled with nix-build -E "$(cabal2nix --shell ./.)"
just fine.
For packages that have the same name as the C library they are wrapping, I imagine this distinction is important, so I'm not sure what's the right thing to do here.
cairo is one example of a same-name bindings library. Remove inherit (pkgs) cairo;
from the cairo derivation call and you get infinite recursion. :-/
From merijn/posix-pty#14 :
libutil is a system library, not a haskell dependency
I suppose the correct solution to the problem is to feed the build with a callPackage
that maps util
to the correct system package.
I believe it could be this lib: https://packages.debian.org/sid/libutil-freebsd-9
So I guess it would be a good idea to package that for Nixpkgs. It's in debian's freebsd-libs and doesn't seem to be packaged independently anywhere else. I'm assuming it's part of FreeBSD proper.
Either way, stack2nix
did the right thing, and the issue is that util
is not in nixpkgs.
Final comment for closure: libutil
is part of glibc
, so I overlayed nixpkgs with a util = null;
and posix-pty
built just fine.