Git Product home page Git Product logo

stackage2nix's Introduction

stackage2nix (DEPRECATED)

Build Status

stackage2nix converts a Stack file into a Nix Haskell packages set.

Create build derivation from stack.yaml

Generate targets from stack.yaml only

stack exec -- stackage2nix .

Command creates file default.nix which overrides haskell.packages.stackage packages set. You should use typeable/nixpkgs-stackage overlay that adds LTS Stackage packages to Nixpkgs.

Build package with overlay installed:

nix-build -A stackage2nix

Generate Stackage packages for the build

If you don't want to use Stackage overlay, stackage2nix can generate required packages with --with-stackage-closure flag.

stack exec -- stackage2nix \
  --all-cabal-hashes /path/to/commercialhaskell/all-cabal-hashes \
  --lts-haskell /path/to/fpco/lts-haskell \
  --with-stackage-closure \
  ./stack.yaml

To generate Stackage packages, supply the --all-cabal-hashes flag with the path to a local clone of all-cabal-hashes checked out on the hackage branch and supply the --lts-haskell flag with the path to a local clone of lts-haskell.

stackage2nix wrapper

You can use stackage2nix wrapper from nix directory that adds required flags:

nix-env -i -f ./nix/stackage2nix
stackage2nix --with-stackage-closure ./stack.yaml

This command will produce packages.nix and configuration-packages.nix Stackage packages and its override in default.nix

Generate full Stackage

--with-stackage parameter generates full Stackage LTS in addition to the targets from stack.yaml

nix-env -i -f ./nix/stackage2nix
stackage2nix --with-stackage ./stack.yaml

Generate Stackage from LTS resolver

You can also generate only Stackage packages set from the resolver:

nix-env -i -f ./nix/stackage2nix
stackage2nix --resolver lts-10.0

This command will produce Stackage packages packages.nix, packages config configuration-packages.nix and a Haskell packages set default.nix.

Runtime dependencies

  • nix-env is required to be on PATH by the distribution-nixpkgs dependency
  • nix-prefetch-scripts is required on PATH if you have git dependencies in stack.yaml

Override result derivation

Complex projects may require some extra customization. Snippet override.nix below shows a minimal example of how to apply additional overrides on top of Haskell packages set produced by stackage2nix.

with import <nixpkgs> {};
with haskell.lib;
let haskellPackages = import ./. {};
in haskellPackages.override {
  overrides = self: super: {
    stackage2nix = disableSharedExecutables super.stackage2nix;
  };
}
nix-build -A stackage2nix override.nix

For more complex overrides and detailed information on how to work with Haskell packages in Nix, see Nixpkgs manual User’s Guide to the Haskell Infrastructure

Tests

Integration tests that build stackage2nix form different yaml configs:

STACKAGE_REPO=<path/to/stackage/repo> \
ALL_CABAL_HASHES=<path/to/all-cabal-hashes/repo> \
STACK_FILE=stack-ghc-7103.yaml \
./ci-stackage2nix

stackage2nix's People

Contributors

4e6 avatar binarin avatar dredozubov avatar fuuzetsu avatar nc6 avatar philderbeast avatar rdnetto avatar traviswhitaker avatar zimbatm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

stackage2nix's Issues

Use nix for caching

This isn't so much an issue as a suggestion for a potential refactor. Basically I'd been thinking of writing my own variant on stack2nix until I saw this one, which actually looks good! The main issue I would see at the moment is that running stack2nix is basically a one-shot that then duplicates the package control in two places - in stack.yaml and in the nix files. It's not clear when these have diverged too much and need syncing, and if the .nix files have been changed, running stack2nix again will simply overwrite them.

An alternative would be to have a multi-stage approach, where we use nix itself to ensure that things are rebuilt at the appropriate times. I envision the workflow as something like this:

stack2nix init

This would do the following:

all-cabal-hashes.json

{
  "owner": "commercialhaskell",
  "repo": "all-cabal-hashes",
  "rev": "xxxx"
}

fetch-repo.nix

{ repoFile }:
let
  repo = builtins.fromJSON (builtins.readFile repoFile);
in builtins.fetchTarball {
     url = "https://github.com/${repo.owner}/${repo.repo}/tarball/${repo.rev}";
   }
  • Check the latest lts-haskell and do the same.
  • Create a derivation for stackage:
let 
  extract-resolver = { stackYaml } : 
    runCommand "extract-resolver" { nativeBuildInputs = [ stack2nix ]; } 
      '' stack2nix extract-resolver ${stackYaml} > $out'';
  stackage = { resolver, allCabalHashes, ltsHaskell } : 
    runCommand "derive-stackage" { nativeBuildInputs = [ stack2nix ]; } 
      '' mkdir -p $out
        cd $out
        stack2nix derive-stackage --resolver ${resolver} --all-cabal-hashes ${allCabalHashes} --lts-haskell ${ltsHaskell} 
      ''
  • Create a derivation for local packages (taking stack.yaml as an input)
  • Create empty override.nix files to allow the user to make modifications atop these packages.
  • Create a simple default.nix which would import the result of the stackage and local builds.

When a user then does something like nix-build -A <pkgname>, the relevant expressions get re-derived and stored in the nix store, or simply retrieved if the inputs haven't changed.

This has the following benefits:

  • stackage only gets re-derived when the resolver changes.
  • #4 and #3 get solved automatically, since these become artifacts in the nix store. Also #13 gets solved.
  • Local packages get re-derived whenever the stack.yaml changes.

I think also that all of the difficult components of this are already done in stack2nix, so it should be relatively easy to do. I'm very happy to work on it if you think it's a reasonable direction to take!

Filter package sources

When stackage2nix is used alongside stack, it is likely that the local packages contain a .stack-work/ folder. Those can quickly grow in size, and when putting the src of the derivation in the store Nix will first try to load up the whole directory in memory. With 6GB+ stack-work/ dirs this quickly becomes a problem.

One solution would be to use cleanSources or builtins.filterSource directly when generating the nix code, assuming that users will never want to have the stack-work/ directories in their nix store. Another solution would be to allow passing a custom filter, potentially operating on the package name for greater flexibility.

Only regenerate `stackage` packages when needed

packages.nix need only be regenerated when the resolver changes (and if the user has made changes to packages-configuration.nix, regenerating when not needed is actively harmful), whereas default.nix might more frequent regeneration (when adding extra-packages, for example).

Simple solution: if packages.nix exists, only regenerate it if --derive-stackage is passed. This would also speed up runtime.

No such package in Cabal database while converting a stack project

Here is a part of my stack.yaml:

extra-deps:
  - avro-0.3.0.4

Running stackage2nix --with-stackage ./stack.yaml gives me this error:

stackage2nix: user error (No such package avro-0.3.0.4 in the cabal database. Did you run cabal update?)

The package is not on stackage, but it is definitely on hackage.

Looks like the error is not specific to avro, other extra-deps packages cause the same error.

I don't see how cabal update is relevant to a Stack project, but I have tried this:

$ stack exec bash
bash-3.2$ cabal update
bash-3.2$ stackage2nix --with-stackage ./stack.yaml

But it didn't help

Memory usage regression

With cabal2nix > 2.5 which depends on hackage-db > 1.22

Issue

Memory usage grows linearly with the number of extra-deps in stack file and is multiple of the size of 01-index.tar hackage-db:

$ memusg stackage2nix stack-1.yaml
memusg: peak=585648

$ memusg stackage2nix stack-2.yaml
memusg: peak=1145812

$ memusg stackage2nix stack-3.yaml
memusg: peak=1707456

$ du ~/.cabal/packages/hackage.haskell.org/01-index.tar         
458752    /home/dbushev/.cabal/packages/hackage.haskell.org/01-index.tar

Where

$ cat stack-3.yaml 
resolver: lts-10.0
extra-deps:
- servant-0.12
- servant-0.12
- servant-0.12

Related: NixOS/cabal2nix#313

Potential problem

For each package in extra-deps stackage2nix calls PackageSourceSpec.getPackage which calls loadHackageDB. It seems that starting from hackage-db > 1.22 it doesn't cache hackage-db and loads new instance for each package.

Prune packages.nix

It is not necessary for packages.nix to list every single package in the LTS: only the packages that are dependencies or transitive dependencies of the projects in the given stack.yaml can be listed. This pruning can be pretty simple and does not have to be perfect: we can just use the argument sets as the set of dependencies even if some would be unused due to any flags in the expression itself.

This should allow a much nicer time when we check in packages.nix into code repository and more importantly, a much more meaningful diff when dependency set is updated: it will become clear what packages we added, updated or removed.

stack2nix cannot run on itself

[nc@varda:~/proj/stack2nix]$ ~/.local/bin/stack2nix --all-cabal-hashes ~/proj/all-cabal-hashes/ --lts-haskell ~/proj/lts-haskell/ .
downloading ‘https://github.com/4e6/cabal2nix.git’... [28/0 KiB, 27.9 KiB/s]
*** parsing cabal file: https://github.com/4e6/cabal2nix.git: openBinaryFile: does not exist (No such file or directory)
stack2nix: nix-prefetch-git: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

Support generating only stackage packages

Should be an option to generate only stackage packages. Ideally this would (as an option) take only the resolver as an input, rather than needing access to the full stack.yaml (this would allow nix to cache it and update only if the resolver changes).

Update configuration-packages.nix files

I ran into the same problem as reported in typeable/nixpkgs-stackage#38 (comment): lens failing to build with a "serious configure-time warning from Cabal " error.

I think the problem is that the configuration-packages.nix being generated by stackage2nix is not up-to-date; in particular one needs to add Cabal, stm, mtl, etc. to the list of core libraries to be used from GHC.

As a workaround for the lens, issue, mtl = null; as an override fixes it.

Support --hackage-db flag

Flag overrides default cabal hackage archive $HOME/.cabal/packages/hackage.haskell.org/00-index.tar

Stack dependencies with subdirs are not supported

I have the following dependencies in my stack.yaml:

- location:
    git: [email protected]:arbor/antiope.git
    commit: ba073b0cd3847f6549960ecdd321259581582146
    subdirs:
      - antiope-core
      - antiope-s3
  extra-dep: true

But stackage2nix doesn't seem to like it:

error: unable to download '[email protected]:arbor/antiope.git': URL using bad/illegal format or missing URL (3)
Initialized empty Git repository in /private/var/folders/3x/l50y6rts50j_9jqyp0fl7lqh0000gn/T/git-checkout-tmp-jsjeU0Lg/antiope-ba073b0/.git/
remote: Counting objects: 148, done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 148 (delta 58), reused 118 (delta 30), pack-reused 0
Receiving objects: 100% (148/148), 17.06 KiB | 5.69 MiB/s, done.
Resolving deltas: 100% (58/58), done.
From github.com:arbor/antiope
 * [new branch]      master     -> origin/master
Switched to a new branch 'fetchgit'
removing `.git'...

git revision is ba073b0cd3847f6549960ecdd321259581582146
path is /nix/store/kws5gdwap71f0j9wmzmvmhkx08qn69zs-antiope-ba073b0
git human-readable version is -- none --
Commit date is 2018-05-28 11:59:58 +1000
hash is 0kgsfv29jjcw3h9c2s57wqnlygkkmav7yplwl6pfj9h7drvy99vw
*** found zero cabal files. Trying hpack...
*** hpack error: "/nix/store/kws5gdwap71f0j9wmzmvmhkx08qn69zs-antiope-ba073b0/package.yaml: Yaml file not found: /nix/store/kws5gdwap71f0j9wmzmvmhkx08qn69zs-antiope-ba073b0/package.yaml". Exiting.

The repository is public (https://github.com/arbor/antiope), and I don't understand why it initially says

error: unable to download '[email protected]:arbor/antiope.git': URL using bad/illegal format or missing URL (3)

It seems that it can download the repo successfully anyway, but then it doesn't recognise that the actual packages are sitting in subfolders.
Both Stack and Nix allow subfolders, so perhaps something can be done on stackage2nix side to support them too.

Make output order consistent

I just adjusted a couple of dependencies in a project and it resulted in 2KLOC change in packages.nix (pruned). I suspect change in transitive dependencies caused some packages to be resolved sooner/later and therefore be placed in different place. If packages are sorted by name, diffs should be much smaller.

I don't have a public test-case, sorry.

Upload to hackage

Aside from anything else, would make this package available in nixpkgs.

Add Travis bootstrap test

Run bootstrap test on Travis:

  • build stack2nix with Stack
  • run stack2nix on the project stack file
  • run nix-build

Pros: checks integrity with latest Nixpkgs
Cons: slow

Build stackage2nix in NixOS sandbox

Unable to build nix/stackage2nix on NixOS with nix.useSandbox enabled.

nix.useSandbox
If set, Nix will perform builds in a sandboxed environment that it will set up automatically for each build. This prevents impurities in builds by disallowing access to dependencies outside of the Nix store. This isn't enabled by default for performance. It doesn't affect derivation hashes, so changing this option will not trigger a rebuild of packages.

`nix-build nix/stackage2nix` fails with could not resolve github.com?

$ nix-build nix/stackage2nix
these derivations will be built:
  /nix/store/6zycxh4iczz9qxzffyb7ickackcjl68f-stm-2.4.4.1.drv
  /nix/store/02n9vy745g7ca51b9ifaiw44pfml1ng9-stm-chans-3.0.0.4.drv
  /nix/store/6gpzsb5lp646frvl83jsgzpfp1jbadnm-text-1.2.2.2.drv
  /nix/store/83jx78vanwx9j4hn52qnp01rda2iz2yh-hashable-1.2.6.1.drv
  /nix/store/79h11zq7mdpd4ik5bk4vzbcpwg22qr8n-unordered-containers-0.2.8.0.drv
  /nix/store/59ilnzy1c77z2ig2sr8i99kn56mpp1ri-integer-logarithms-1.0.2.drv
  /nix/store/6dfwf8vmp5abfa924a7dpq244y32fp9a-primitive-0.6.2.0.drv
  /nix/store/aqf8b6wp7r9xb9vsiq7abll5rhfr2yik-scientific-0.3.5.1.drv
  /nix/store/97kaqsfl3il3pifkigxkji1nvcygn85c-attoparsec-0.13.1.0.drv
  /nix/store/bfxckvbg6ibi6awz1d2sfy7axsh22nl9-base-compat-0.9.3.drv
  /nix/store/flbxmyh9la7jx7nv20wp4k34jw46qsz8-dlist-0.8.0.3.drv
  /nix/store/dj2d4f7c6112vnd1jmyka8aix6pn7jk2-transformers-compat-0.5.1.4.drv
  /nix/store/k1b5ji03kfv5f0nl6jyyyhvjlkqkm1s7-tagged-0.8.5.drv
  /nix/store/1rlaxsp2kjmb4nwizcsw0hfc638rd9x0-random-1.1.drv
  /nix/store/pvn3rsrsrln55phn6vi0x7dydv1n380j-uuid-types-1.0.3.drv
  /nix/store/ynyk5nzy2kdv2vz8kx33128mkk95zssm-vector-0.12.0.1.drv
  /nix/store/zqql05y47bhjdfffrd0pvryjh02mz6n3-time-locale-compat-0.1.1.3.drv
  /nix/store/06s32wzjs27f58al4zg15jb5xk6y2q80-aeson-1.1.2.0.drv
  /nix/store/2wkw2f3clwx08yg8h0y62s2mpdvx76zr-semigroups-0.18.3.drv
  /nix/store/r3kxi73kffxz64qjyrflsgi0194frdyj-Cabal-2.0.0.2.drv
  /nix/store/4sa45wqk2213xxmj3f7hijxk6yy7s5kc-cabal-doctest-1.0.2.drv
  /nix/store/azsyk8m2zzj2wf9a0lxn9rw34arm9mpw-void-0.7.2.drv
  /nix/store/m6qiscrf0gg5h76dfplcs8xbsf5m5ixx-StateVar-1.1.0.4.drv
  /nix/store/mdb7chd4fvkr84j1kznyg1r36pgrp4jh-contravariant-1.4.drv
  /nix/store/md4cx8jvd3lbmfv3lv4dz7ch6kvn56sy-base-orphans-0.6.drv
  /nix/store/x8v1j8cjqcd4jmclqk1d4zg88p5gns39-distributive-0.5.3.drv
  /nix/store/gd8m915f4m0c5zrwg7fzqdl1i2z6v3xr-comonad-5.0.2.drv
  /nix/store/kzpa2zvll0zpfbhn7f5ir5sylkiiy3fy-bifunctors-5.4.2.drv
  /nix/store/0m8490795rpjir2fa03ddfvsj22d3rsi-semigroupoids-5.2.1.drv
  /nix/store/0nk0wfddzmf003qixfh272blwnn9aq5a-chunked-data-0.3.0.drv
  /nix/store/7mlnrwhzwc4p7rfi59c1xm6h94lqp82b-data-default-class-0.1.2.0.drv
  /nix/store/0pqmx9pi0gqsnhmr7g5hjsvvcr7mnc1h-data-default-instances-dlist-0.0.1.drv
  /nix/store/0yap0x6jkz6d6pn7vhi03dbrz9qq2if6-network-2.6.3.2.drv
  /nix/store/jhmkwg125lhwlfmgrda2s9mspb2s9d3y-blaze-builder-0.4.0.2.drv
  /nix/store/vv3yf3vyi6m88pfcfgbik3wvmnycm9d6-case-insensitive-1.2.0.10.drv
  /nix/store/7q74dl584jdv8w8fr05n008qg51hmpcm-http-types-0.9.1.drv
  /nix/store/78chwa6qcq7cc18lpa9rp3132ib6j5dl-mtl-2.2.1.drv
  /nix/store/jgs2fbmngvk810cak6qhb8dyjv6v5mn0-hourglass-0.2.10.drv
  /nix/store/r1rbzqsbx8y0glpw7smfrifb2k7yc7j7-foundation-0.0.13.drv
  /nix/store/llv0l7z41b0khkhri635j24sm0m1rim6-memory-0.14.6.drv
  /nix/store/8dm2vd8a5rdvjfqisvj5ikm4vljvrziw-asn1-types-0.3.2.drv
  /nix/store/b24nmsfdxdvkfgp1990240p662gmg6kw-base64-bytestring-1.0.0.1.drv
  /nix/store/fhn6fn1bh5dd36lszzx9faqhzrz3wbra-pem-0.2.2.drv
  /nix/store/jilvhxlbv4dawi3bzdcslh8isr77wpws-cryptonite-0.23.drv
  /nix/store/l3x19zmgqzj1vxm7nwjmifzqk6qw1rxw-asn1-encoding-0.9.5.drv
  /nix/store/d6i83sg6l2irdhkcqq59wh7jcslilcxi-asn1-parse-0.9.4.drv
  /nix/store/msfp7ix1zm8d5c81gdkv4ph03804jc2m-x509-1.7.2.drv
  /nix/store/vhj6k0c4j52advy36ljq0b6sg2hh5izd-byteable-0.1.1.drv
  /nix/store/xynl3s92ps1l2aw7y0a9hs4gsdc54ng1-x509-store-1.6.5.drv
  /nix/store/brvp9kqndmy220a4zv9zy5dxjswhanhw-x509-validation-1.6.9.drv
  /nix/store/7qdngh258hysr0v5d7xqcg0239z4yi8l-async-2.1.1.1.drv
  /nix/store/kxahwll55m2jj0qcxfi3nxrd1qrdkxbf-cereal-0.5.4.0.drv
  /nix/store/j4hm14lv1iyadk3821bacfx7ifv9403l-tls-1.3.11.drv
  /nix/store/p0mym6g5lcfy9yjbcz8hzvacqxvisls7-x509-system-1.6.6.drv
  /nix/store/whlixph5cjz3lm30ag0xi683yllfqhwp-socks-0.5.5.drv
  /nix/store/agm308j5pbmx2j3mqzq12zx9b4rrp4ka-connection-0.2.8.drv
  /nix/store/2682xmgv02kx90gb3p2f7av3pq66ba0i-parsec-3.1.11.drv
  /nix/store/scw359xv57l54gagdg00mzlkg4a4d012-network-uri-2.6.1.0.drv
  /nix/store/hghb6k3sqc1zdjnfm90nrk31qld35nvz-old-locale-1.0.0.7.drv
  /nix/store/v3fjllzlrkvhq5zrlrzd8ziz1q5sibdz-cookie-0.4.2.1.drv
  /nix/store/xdha9kp44fdh2vvmfss5ng04zbzykf2j-mime-types-0.1.0.7.drv
  /nix/store/y9gnggwwpi9686lyacpmd9baycmvlkgk-exceptions-0.8.3.drv
  /nix/store/jhrr5vw65qsgmlmdz95bsy7rxmdkffhz-zlib-0.6.1.2.drv
  /nix/store/z0wkdd6q5c8rax4nwnd4kqc9akn738rx-streaming-commons-0.1.17.drv
  /nix/store/pa0jzgfyi7hi2njj9ha7h55gjqdy5bzy-http-client-0.5.7.0.drv
  /nix/store/0pw650gcz8bgwjr2hc6xl45iww5in8mi-http-client-tls-0.3.5.1.drv
  /nix/store/0s1k09fb57ibc1r84x64yn7hh6878dia-say-0.1.0.0.drv
  /nix/store/0s9i7y0fv61bakd3b8gfghsmagfg53xj-call-stack-0.1.0.drv
  /nix/store/0zwmff0pvcj5vng1c209nqw6pissllqr-unix-compat-0.4.3.1.drv
  /nix/store/dhw3iikr3q2yndmr02qmp1z1k3j937xv-th-lift-0.7.7.drv
  /nix/store/i69sx7g5ib8x7024cck0400cxkx1vkph-syb-0.7.drv
  /nix/store/f2r1bd31lbbpgl6a2fiz9h267qgxj14i-th-expand-syns-0.4.3.0.drv
  /nix/store/zlrm7gxsba9ld9v1kj6k14a5d8ssjvd5-safe-0.3.15.drv
  /nix/store/v2irjmkalvnias2kp3p7q5vghdpg39bc-th-reify-many-0.1.8.drv
  /nix/store/w6n1ww4jr9vprjr89hg2072bxbxbbhmk-th-lift-instances-0.1.11.drv
  /nix/store/14s4cnszaah7r3yvp3pwynwxpdkz33s9-th-orphans-0.13.4.drv
  /nix/store/1dhlgdn8rrsv7gn9i83zsadsykd5560s-auto-update-0.1.4.drv
  /nix/store/1g5sfnh80pwqr9minz7qdnavdg79qgj2-ini-0.3.5.drv
  /nix/store/26z1j2rm75qcyfcjwjg3lrxaq4pmx3z8-vector-th-unbox-0.2.1.6.drv
  /nix/store/b16jpby4cq6a44v30919iwb88ycmlw90-math-functions-0.2.1.0.drv
  /nix/store/54n4svvjjll08v05b8c8xrr8dw3iaxsm-mwc-random-0.13.6.0.drv
  /nix/store/ilidnmw41phk4177a1pabi56imzailfj-vector-algorithms-0.7.0.1.drv
  /nix/store/mi055wcdn7qpw95swyg8j3bsra65m7g6-split-0.2.3.2.drv
  /nix/store/yxpgvm9nij2g93f777c4pxdag3mhm618-mono-traversable-1.0.2.1.drv
  /nix/store/30p20xhzr291fm0nvxxg55jhflyi1s92-mutable-containers-0.3.3.drv
  /nix/store/5mxlmk7wgbvlz62z970whbwjm2rj5bvv-system-filepath-0.4.13.4.drv
  /nix/store/g6ypwp2nz82jvqx8lvy2i052fm55vrv8-ReadArgs-1.2.3.drv
  /nix/store/g6mnn5l0x2fgxdy25xrfhwymd87dq8ma-transformers-base-0.4.4.drv
  /nix/store/7vkbpvixgdb3pgqbdkpy808g7a3dqljg-monad-control-1.0.2.2.drv
  /nix/store/zkx4cirk13nqwdvb8npczfl1ddlp1al7-lifted-base-0.2.3.11.drv
  /nix/store/43b6424ykcfxxy57a10sfdj6bssih021-basic-prelude-0.6.1.1.drv
  /nix/store/4853zhh6h35sgszg5wwyhdb9q920i5n2-safe-exceptions-0.1.6.0.drv
  /nix/store/6kamx2vx7r1qi87sg3359s8d2b9v7bjr-dlist-instances-0.1.1.1.drv
  /nix/store/3212xrhipmfyqdjwns52bqr3bpfiix86-fail-4.9.0.0.drv
  /nix/store/ij0dk86abq8pnwzv26ssxbhj7f2s7n7w-profunctors-5.2.1.drv
  /nix/store/6zyf1zgkmxyxzpzcp6nzsyzc05k42jnq-prelude-extras-0.4.0.3.drv
  /nix/store/k59s76glcns065wlxp12008783l0036p-free-4.12.4.drv
  /nix/store/4x2jx1cizz3ahkdmajhnpqgp121qniyp-adjunctions-4.3.drv
  /nix/store/28pn32bi0fzxngpg1fcq16845agyhbvr-kan-extensions-5.0.2.drv
  /nix/store/5z1b8whs55xfqb9g3bqnd8i87bn7a5nc-pointed-5.drv
  /nix/store/pqkbrb5ribn4by0b8hrkxlcibd0d1zg1-keys-3.11.drv
  /nix/store/sds26gq0z9k0vfsfrss9vpxg54bsg7fq-vector-instances-3.4.drv
  /nix/store/hpn8yds1i68axa20j56394rcvlj4pnm7-mono-traversable-instances-0.1.0.0.drv
  /nix/store/y2npy2wkj113ci5dacnrbm6xrq8wxql6-constraints-0.9.1.drv
  /nix/store/hpsp43g8fivgispw05rcxzgjzz4h6pv9-lifted-async-0.9.3.drv
  /nix/store/ihfcqkhn660ngn671wmf0gaa4drpsk53-monad-unlift-0.2.0.drv
  /nix/store/1gyy6ywmsv90a76j86rpnqx6vfmkv4qq-classy-prelude-1.2.0.1.drv
  /nix/store/699paaw6a0pqpl85ivlp1dcn8vmf3qn2-mmorph-1.0.9.drv
  /nix/store/ciy9g8ycwyfh0ilzrql3m0552m6djx0d-resourcet-1.1.9.drv
  /nix/store/f531fq152mzrj5pgxvxbnik4vvafxvfh-conduit-1.2.11.drv
  /nix/store/6pzplvkpc627slncw6lk3a42fc9ainrm-conduit-extra-1.1.16.drv
  /nix/store/zj823fxnz9y7x1j393c74dzpfkv2038y-base16-bytestring-0.1.1.6.drv
  /nix/store/2672i97dg3vfawsm5yrd0farn4h69w7b-conduit-combinators-1.1.1.drv
  /nix/store/5na51pqqjpa746qzb7dd8hmjm9gf5z01-reflection-2.1.2.drv
  /nix/store/7954ds8zszkqxwyxs8bhhl4i3i55rvhp-parallel-3.2.1.1.drv
  /nix/store/xm1whqz16h12ins9vk5yrcmsj9yda8ih-th-abstraction-0.2.5.0.drv
  /nix/store/389vgrk8nnnv5kjwkrv0f5z7qfmbnsw9-lens-4.15.4.drv
  /nix/store/40k13qgdarzls63spxjsghghv7cysz9d-cryptohash-0.11.9.drv
  /nix/store/4p9wwcpfbm015pbn68rywwakq44b9dw7-temporary-1.2.1.1.drv
  /nix/store/6bw6cr8lw1wi97js0ly2sh5g43i1bf37-monad-unlift-ref-0.2.0.drv
  /nix/store/77g9vq2h2qlki065vz6gqypqpvsal80k-utf8-string-1.0.1.1.drv
  /nix/store/fbi30ya80php3260qx8c3bxy83nm76dm-retry-0.7.4.2.drv
  /nix/store/j5wrsglvia1ay55szdsam5x78fladm43-http-conduit-2.2.3.2.drv
  /nix/store/aslkfjsj4dxqfij9rplpwibi1h0w40fd-blaze-markup-0.8.0.0.drv
  /nix/store/mdq13v7lh70wj7mc0cin9d7y82v7qly3-data-default-instances-old-locale-0.0.1.drv
  /nix/store/nplg7r4az598s5ircpy5bf2wnzryfc3w-data-default-instances-containers-0.0.1.drv
  /nix/store/dgr4vv4qgvzw6gy41yr8j5f69djgg5s0-data-default-0.7.1.1.drv
  /nix/store/w37lzj787qpg831qzs7j8maqwil7cmi8-blaze-html-0.9.0.1.drv
  /nix/store/wa1w711cn7i26xvg1xfz5blz1cvcsg4s-xml-types-0.3.6.drv
  /nix/store/nd2926fvls9qxg6x4v6m8dxxgggpi09s-xml-conduit-1.5.1.drv
  /nix/store/igg4xf1x83jdwzyxnqwyyzwfzdlwrkl0-amazonka-core-1.4.5.drv
  /nix/store/93mkz9961ib0qr313cqb9i7k8nck8500-amazonka-1.4.5.drv
  /nix/store/d4x4a5nknp73lcf1nxfx1qmr2qh34f1r-amazonka-s3-1.4.5.drv
  /nix/store/frcw9j7105b6rzw3cwx0k6in1hiipgdi-stackage-curator-0.15.0.0.tar.gz.drv
  /nix/store/hznpmkhy04y6xrnjzd2bi71i2b7ljih4-system-fileio-0.3.16.3.drv
  /nix/store/dqw03hivmmvpxwgjg7fk6w9xxa3xc8kg-ansi-terminal-0.6.3.1.drv
  /nix/store/88l88451if9qvyw943gd5cbblsdzjg5i-ansi-wl-pprint-0.6.7.3.drv
  /nix/store/i2nshh74bfvisw2fzmpw1kd127nz6xaq-optparse-applicative-0.13.2.0.drv
  /nix/store/9wqjvh0vsl3ycdf2dbpjcrsbx0dqckd8-setenv-0.1.1.3.drv
  /nix/store/j9iy2ra8k1rk6y4j9ggjyqmmfqy2z4br-HUnit-1.5.0.0.drv
  /nix/store/qan9f64n1hjck64gc1grh6qcr6y3qpwy-tf-random-0.5.drv
  /nix/store/spid89prvsbp4n7qzk7f54v7dwxnz3dw-QuickCheck-2.9.2.drv
  /nix/store/jgh9ads9fmqlk7bf5dwbi52wv4hgbv86-quickcheck-io-0.2.0.drv
  /nix/store/jyvw6pb4qqx7a1syx859giwcndby4fis-hspec-expectations-0.8.2.drv
  /nix/store/ahzc2s0gdqyymjwcmhbh7r0qm49s6r0z-hspec-core-2.4.4.drv
  /nix/store/jy9c3h9ppg4di2smyr5cwa1j91q5n0cc-hspec-discover-2.4.4.drv
  /nix/store/4pq6zc40nyasiyjambvq2jxq0cym7fmw-hspec-2.4.4.drv
  /nix/store/zcyrszqygfbwrv3n8alcsgmldwqi1gpf-logict-0.6.0.2.drv
  /nix/store/has0l7nq36q5vikd8ya09ymmf56fasxl-smallcheck-1.1.2.drv
  /nix/store/9ic9w2ly64wc9d41lbc8bsn8rsbn6kyz-hspec-smallcheck-0.4.2.drv
  /nix/store/d02axp1s3g8nfpczsvpvj60rnm7m23si-th-utilities-0.2.0.1.drv
  /nix/store/wqpgqvyrf3pgnlwhxx51px0ajfjyipv0-store-core-0.4.1.drv
  /nix/store/k5lsnhgif9vw565s82bbmna29q4dq2lr-store-0.4.3.1.drv
  /nix/store/lj9x45y1xccbzv68907hnq8i8jsy6dbj-tar-0.5.0.3.drv
  /nix/store/mda89jjx8a4dn5qfrc2pg813fscln6al-yaml-0.8.23.3.drv
  /nix/store/nhnyd07nmdv3r0y07hjziv0jkq4sxj56-classy-prelude-conduit-1.2.0.drv
  /nix/store/bx0s51fklvjj0lr5mycnskfpfzwpdkk4-tagstream-conduit-0.5.5.3.drv
  /nix/store/qmxwf73dbysjqmahmvp7ghvqlc5n8da6-html-conduit-1.2.1.1.drv
  /nix/store/bfkk31sp1jpnhimvdpl6ql8b2zvkh96g-gitrev-1.3.1.drv
  /nix/store/jmf8p29lmmh6if9zzab29zv356g5fln4-MonadRandom-0.5.1.drv
  /nix/store/g7mqrf8gjsn74mr8g5p9v61ms5hnamqq-either-4.4.1.1.drv
  /nix/store/qvllyjh0n9v04dczdch4c76q61pws49k-optparse-simple-0.0.3.drv
  /nix/store/r49xzyj8hyfbz888hm4p402dwkd3xvnz-cryptohash-conduit-0.1.1.drv
  /nix/store/zi2klxbj9fhlwabjvhj3fnw7nchjgj8b-lucid-2.9.8.1.drv
  /nix/store/4fnj3dcamgi5hk1j8v1zxhfypxakbnbp-stackage-curator-0.15.0.0.drv
  /nix/store/40vrd1f1acqmdhd66pmjq080m39451r8-hackage-db-1.22.drv
  /nix/store/k6bd8mvwb7gdd45dnls1k1yiljn52qgw-abstract-par-0.3.3.drv
  /nix/store/7b8x1jkijh8dbi3vc3968h7m0vl4f46b-monad-par-extras-0.3.3.drv
  /nix/store/dlw0w4n1lph48ldkyj30rc6199i0skcn-language-nix-2.1.0.1.drv
  /nix/store/qqvdw1c7rqr2vvkfx50zpiykcj69yl5h-hopenssl-2.2.1.drv
  /nix/store/8yd6w83cs61x0w1jmqmv83hwcvrcpgz5-abstract-deque-0.3.drv
  /nix/store/xkkqm39w1qqv7bmlw19bn4z0vjzgf11w-monad-par-0.3.4.8.drv
  /nix/store/zxp395af5c063a7ryx7q6ch465imfmdk-distribution-nixpkgs-1.1.drv
  /nix/store/5xj72cpxi55q9770vzm3ydffj1bwwf5a-cabal2nix-2.5.drv
  /nix/store/mjacmdc9nq7zvd4gkqgf3ffjpgs4g24p-megaparsec-5.3.1.drv
  /nix/store/81hvjxp883fdkm5zamsh0x9kdvyhi2hb-inflections-0.3.0.0.drv
  /nix/store/4snbd8zn6rhxdkcsjsfii8n16pl25c1j-text-icu-0.7.0.1.drv
  /nix/store/ndxcf0krd068mbpffa4an23prf9dbwba-old-time-1.1.0.3.drv
  /nix/store/4399zl8plqyqs1lw5n8f645wnd27kkdi-unix-time-0.3.7.drv
  /nix/store/9avbmi44g1dq2h5rpazb5q1lqp1bg9xr-easy-file-0.2.1.drv
  /nix/store/629gz76cqcffzd8gwdvhm8p9bf1am5f8-fast-logger-2.4.10.drv
  /nix/store/6l42i389fyg4z60blbf96c2s81frv862-monad-loops-0.4.3.drv
  /nix/store/a0wz84w4k6ap6vig2dv7dgv8kcn7gc08-cereal-conduit-0.7.3.drv
  /nix/store/996vf4mn39y61drr8p3q77d70qc69m0z-stm-conduit-3.0.0.drv
  /nix/store/6967bczrmcpgpnajfj54458lkzidnz3y-bindings-DSL-1.0.23.drv
  /nix/store/sblamis2l18cjn0k551fxkz4hvimij6s-hlibgit2-0.18.0.16.drv
  /nix/store/w6r64a5s54spijk9hmplc3nm2fyr237i-gitlib-3.1.1.drv
  /nix/store/9k77w3g5lvvxa8rfwfwbvfjfzqjfrhzm-gitlib-libgit2-3.1.1.drv
  /nix/store/3lg21a2l6wsxlzhp33wzcmxfdy78rndb-stackage2nix-0.3.0.drv
  /nix/store/6z50cz9l2ps94i8mvlljjaaz1q0hdfjd-stackage-nightly.drv
  /nix/store/k6qw32xy0b4gb5qlzn4zi3ja760iw9qw-stackage-lts.drv
  /nix/store/5s74xb2s5kg63c7jdrnnh1jqb7jvz5aq-stackage-all.drv
  /nix/store/rl8n5pz6y2nq8rzk1jdzx4h7h6wxza69-all-cabal-hashes.drv
  /nix/store/ziy2p3q73lh6kg4vpk68b6b1zf7y6xdn-hackage-db.drv
  /nix/store/xdbacsmnyxjkqgxxkyxklxg1f7g75cy4-stackage2nix-0.3.0.drv
these paths will be fetched (0.14 MiB download, 0.14 MiB unpacked):
  /nix/store/q02w0q7j3880wqpp7x7x2pqn2kgibhdp-zlib-0.6.1.2.tar.gz
building path(s) ‘/nix/store/3x0pigmmsvh37h7blakdf3cxl7r45am8-all-cabal-hashes’
building path(s) ‘/nix/store/iiia53r08hc9av9m3l7cxjligp9a7z4d-hackage-db’
building path(s) ‘/nix/store/zh0fqh4wxw2q3p4058gnlpi055ss4sn4-Cabal-2.0.0.2’
building path(s) ‘/nix/store/swwgy9k9vaa2q94hhmndy0snacrsnlzc-stackage-lts’
installing
Cloning into '/nix/store/3x0pigmmsvh37h7blakdf3cxl7r45am8-all-cabal-hashes'...
fatal: unable to access 'https://github.com/commercialhaskell/all-cabal-hashes.git/': Could not resolve host: github.com
installing
/nix/store/iiia53r08hc9av9m3l7cxjligp9a7z4d-hackage-db /tmp/nix-build-hackage-db.drv-0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: hackage.haskell.org
setupCompilerEnvironmentPhase
Build with /nix/store/d6if3dbbw34vpl6hp6bm3jnrsb2iypil-ghc-8.0.2.
unpacking sources
unpacking source archive /nix/store/x80cka53xqlvzyl7qlln7wcdhqh98llf-Cabal-2.0.0.2.tar.gz
installing
Cloning into '/nix/store/swwgy9k9vaa2q94hhmndy0snacrsnlzc-stackage-lts'...
fatal: unable to access 'https://github.com/fpco/lts-haskell.git/': Could not resolve host: github.com
builder for ‘/nix/store/rl8n5pz6y2nq8rzk1jdzx4h7h6wxza69-all-cabal-hashes.drv’ failed with exit code 128
builder for ‘/nix/store/ziy2p3q73lh6kg4vpk68b6b1zf7y6xdn-hackage-db.drv’ failed with exit code 6
builder for ‘/nix/store/k6qw32xy0b4gb5qlzn4zi3ja760iw9qw-stackage-lts.drv’ failed with exit code 128
cannot build derivation ‘/nix/store/xdbacsmnyxjkqgxxkyxklxg1f7g75cy4-stackage2nix-0.3.0.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/xdbacsmnyxjkqgxxkyxklxg1f7g75cy4-stackage2nix-0.3.0.drv’ failed

Can't install on Nixos

Probably that could be filed to nixpkgs repo but maybe it's something of a known issue.
I'm using nixos-18.03, trying to install stackage2nix with nix-env -f "<nixpkgs>" -i -A haskellPackages.stackage2nix, fails with

Using Cabal-2.2.0.0 compiled by ghc-8.2
Using compiler: ghc-8.2.2
Using install prefix:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1
Executables installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/bin
Libraries installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/lib/ghc-8.2.2/stackage2nix-0.6.1
Dynamic Libraries installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/lib/ghc-8.2.2/x86_64-linux-ghc-8.2.2
Private executables installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/libexec/x86_64-linux-ghc-8.2.2/stackage2nix-0.6.1
Data files installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/share/x86_64-linux-ghc-8.2.2/stackage2nix-0.6.1
Documentation installed in:
/nix/store/bbynd4lcpyf9xm6mqlsf59rlnlb8jv6d-stackage2nix-0.6.1-doc/share/doc
Configuration files installed in:
/nix/store/rzx2v29a4xxh5c7g8zj1jzjfrvylq041-stackage2nix-0.6.1/etc
No alex found
Using ar found on system at:
/nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 7.3.0 given by user at:
/nix/store/gqg2vrcq7krqi9rrl6pphvsg81sb8pjw-gcc-wrapper-7.3.0/bin/gcc
Using ghc version 8.2.2 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/ghc
Using ghc-pkg version 8.2.2 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.18.1 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.67 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/hpc
Using hsc2hs version 0.68.2 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/61pyr6v0zpypaicz1n8gk63agm8128b4-hscolour-1.24.2/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/cmxaqb5cbzy4jk26na842n6hy1s4yn19-binutils-wrapper-2.28.1/bin/ld
No lhc found
No lhc-pkg found
No pkg-config found
Using runghc version 8.2.2 found on system at:
/nix/store/hjvv3ayhyddz2piydw8rra85pczbsz9j-ghc-8.2.2/bin/runghc
Using strip version 2.28 found on system at:
/nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin/strip
Using tar found on system at:
/nix/store/2p00w952ljb1172nsf3jm7nsjgsw5qpw-gnutar-1.30/bin/tar
No uhc found
*** abort because of serious configure-time warning from Cabal
builder for '/nix/store/vi5ny3sijd4h51g2ag30k07fh6ix9cch-stackage2nix-0.6.1.drv' failed with exit code 1
error: build of '/nix/store/vi5ny3sijd4h51g2ag30k07fh6ix9cch-stackage2nix-0.6.1.drv' failed

Make --lts-haskell flag optional

Stack environment should have some kind of lts-haskell repository available. Find a way to reuse it and make flag --lts-haskell optional

Add override flags for Nix generic-builder

Currently, cabal2nix supports following CLI flags:

  • --no-check
  • --no-haddock
  • --no-hyperlink-source

Appropriate CLI flags for stack2nix should accept a list of parameters (packages); an empty list means override globally for all packages.

Respect packages in stack.yaml `nix` section

If additional dependencies are specified in stack.yaml, as per:

nix:
  packages: [ openssl ]

they should be added to the package configuration using addBuildDepend for the packages defined in default.nix.

Generate Haskell packages with buildHaskellPackages argument

NixOS/nixpkgs@8155312 introduced new argument to the makePackageSet function. There is also a fix NixOS/nixpkgs#34557 that adds backward compatibility.

When either of them lands into the release branch, generation of Haskell packages should be updated as follows:

--- a/stackage/lts-10.0/default.nix
+++ b/stackage/lts-10.0/default.nix
@@ -1,5 +1,5 @@
 # Generated by stackage2nix 0.6.0 from "/home/dbushev/projects/fpco/lts-haskell/lts-10.0.yaml"
-{ callPackage, pkgs, stdenv, lib, overrides ? (self: super: {})
+{ callPackage, buildPackages, pkgs, stdenv, lib, overrides ? (self: super: {})
 , packageSetConfig ? (self: super: {})
 }:
 
@@ -7,18 +7,19 @@ let
   inherit (lib) extends makeExtensible;
   haskellLib = pkgs.haskell.lib;
   inherit (haskellLib) makePackageSet;
-  
+
   haskellPackages = pkgs.callPackage makePackageSet {
-                      ghc = pkgs.haskell.compiler.ghc822;
+                      ghc = buildPackages.haskell.compiler.ghc822;
+                      buildHaskellPackages = buildPackages.haskell.packages.ghc822;
                       package-set = import ./packages.nix;
                       inherit stdenv haskellLib extensible-self;
                     };

Make compiler easier to configure

The output of haskell-packages/default.nix at the moment looks something like this:

{ nixpkgs ? import <nixpkgs> {} }:

with nixpkgs;
let  ...
in callPackage (nixpkgs.path + "/pkgs/development/haskell-modules") {
  ghc = pkgs.haskell.compiler.ghc843;
  buildHaskellPackages = buildPackages.haskell.packages.ghc843;
  ...
}

It would be probably nicer if the compiler were another parameter. e.g.:

{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc843" }:

with nixpkgs;
let  ...
in callPackage (nixpkgs.path + "/pkgs/development/haskell-modules") {
  ghc = pkgs.haskell.compiler.${compiler};
  buildHaskellPackages = buildPackages.haskell.packages.${compiler};
  ...
}

That way one could more easily reuse the same expression with newer versions of nixpkgs, in particular one where only ghc844 is available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.