Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Stack 2 #2

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

Migration to Stack 2 #2

wants to merge 11 commits into from

Conversation

nh2
Copy link
Owner

@nh2 nh2 commented Jul 12, 2021

Based on PR #1 by @qrilka who did most of this work (but I cannot push commits on that branch).

Seems to work!

nh2 and others added 11 commits May 29, 2019 16:49
Most importantly for me, fixes `integer-simple` being missing from the list,
which resulted in `static-haskell-nix` not being able to build static exes
using `integer-simple` if the package set was generated by `stack2nix`.

Also updates the list to recent GHCs and adds commentary.
Prevents stack2nix generating `src = ./.` as the path for the project
stack2nix is run against.
The output of stack.nix (a `.nix` file containing that `src`) is often
added to the nix store, `./.` would add the contents of the entire
`/nix/store` as `src`!
Without a GHC on PATH, stack complains:

    stack2nix: No compiler found, expected minor version match with ghc-8.10.4 (x86_64) (based on resolver setting ...

stack2nix never uses GHC, so accepting any GHC should be fine.
nh2 added a commit to nh2/static-haskell-nix that referenced this pull request Jul 12, 2021
This uses @qrilka's work from nh2/stack2nix#1,
now moved to nh2/stack2nix#2.

Unfortunately, this introduces a backwards incompatibility for stack users:

The `stack2nix-script` nix expression now needs to be passed `inherit compiler`,
to satisfy stack complaining if there's no matching GHC on PATH
(even though we don't use it).

I haven't found a way around that yet.

Example change that users need to make in their `default.nix` for building
stack projects statically:

       stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
         inherit pkgs;
    +    inherit compiler;
         stack-project-dir = toString ./.; # where stack.yaml is
         hackageSnapshot = "2021-07-11T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
       };
nh2 added a commit to nh2/static-haskell-nix that referenced this pull request Jul 12, 2021
This uses @qrilka's work from nh2/stack2nix#1,
now moved to nh2/stack2nix#2.

Unfortunately, this introduces a backwards incompatibility for stack users:

The `stack2nix-script` nix expression now needs to be passed `inherit compiler`,
to satisfy stack complaining if there's no matching GHC on PATH
(even though we don't use it).

I haven't found a way around that yet.

Example change that users need to make in their `default.nix` for building
stack projects statically:

       stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
         inherit pkgs;
    +    inherit compiler;
         stack-project-dir = toString ./.; # where stack.yaml is
         hackageSnapshot = "2021-07-11T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
       };
nh2 added a commit to nh2/static-haskell-nix that referenced this pull request Jul 20, 2021
This uses @qrilka's work from nh2/stack2nix#1,
now moved to nh2/stack2nix#2.

Unfortunately, this introduces a backwards incompatibility for stack users:

The `stack2nix-script` nix expression now needs to be passed `inherit compiler`,
to satisfy stack complaining if there's no matching GHC on PATH
(even though we don't use it).

I haven't found a way around that yet.

Example change that users need to make in their `default.nix` for building
stack projects statically:

       stack2nix-script = import "${static-haskell-nix}/static-stack2nix-builder/stack2nix-script.nix" {
         inherit pkgs;
    +    inherit compiler;
         stack-project-dir = toString ./.; # where stack.yaml is
         hackageSnapshot = "2021-07-11T00:00:00Z"; # pins e.g. extra-deps without hashes or revisions
       };
@nh2
Copy link
Owner Author

nh2 commented Jul 23, 2021

This is working, and static-haskell-nix uses it since PR nh2/static-haskell-nix#98.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants