input-output-hk/stack2nix

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.

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.