Open lf- opened 2 years ago
The specific motivation for this is that nixpkgs forces you to a particular version of libraries (sometimes undesirable if you don't wanna write an overlay), and often things are marked broken. That said, it would also be good to have a mode where it just cabal2nix's the thing for you and does provide binary libraries.
It would be sweet if riff could provision a haskell compiler and haskell language server with the appropriate native dependencies.
It's true that nixpkgs can do this itself but sometimes you legitimately don't want nixpkgs to give you any of the haskell libraries, especially while hacking on random software. Or it's just too Annoying to write a nix expression for all the stuff.
This might be a bit of a tall order: the hard example I'd suggest is persistent-sqlite, which has a dependency on native sqlite.
The system sqlite library gets into there in librarySystemDepends (see hackage-packages.nix in nixpkgs)
That gets found by cabal2nix from a package flag that adds an extra-libraries declaration to the cabal file https://github.com/yesodweb/persistent/blob/master/persistent-sqlite/persistent-sqlite.cabal#L71 (the flag is set by cabal2nix per https://github.com/NixOS/cabal2nix/blob/master/src/Distribution/Nixpkgs/Haskell/FromCabal/Flags.hs#L55)
Thought of course of implementation:
Automate calling cabal2nix without needing to know the package name. Probably read cabal.project if possible to find all the local packages.
Write a funny Nix function that extracts all the transitive system dependencies from some haskell derivation from cabal2nix, then constructs a mkShell.
cc @Hoverbear