Skip to content

Merger? #34

@dmjio

Description

@dmjio

Hi @jmitchell, I've been attempting to use stack2nix to generate nix expressions for GHCJS packages. I had trouble trying to specify --compiler ghcjs when stack2nix gets run, since (afaik) the command line arguments to stack2nix aren't the same as what is given to cabal2nix.

This led to some digging into the code and I noticed cabal2nix was being ran as a subprocess, and the generated nix was being parsed by hnix, and the lines related to testHaskellDepends and benchmarkHaskellDepends are being removed from the nix AST in order to satisfy nix during builds (since stack doesn't include test dependencies in the stack list-dependencies output).

In an attempt to support GHCJS packages, I began a small rewrite that simply passes the command line arguments from stack2nix to every invocation of cabal2nix directly (with minor modification). This led to a PR in cabal2nix that exposed the Derivation type from language-nix (NixOS/cabal2nix@cb2265e) which should obviate the need to use hnix in stack2nix.

-- Can remove various sections in `Derivation` in `language-nix` before pretty printing.
 let upd = d' & benchmarkDepends .~ mempty
              & testDepends .~ mempty

https://github.com/dmjio/nixFromStack

Just like stack2nix, The generated nix is in a format that can be used in the same way as hackage-packages.nix.

{ 
  stackPackages = haskellPackages.override { 
    initialPackages = import ./stackage-packages.nix;
  }
}

I'm not sure if nixFromStack can do everything stack2nix can do, but, if possible, was wondering if you'd be interested in combining efforts in some way. Like merge the two code bases, however hairy that process may be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions