Closed david-janssen closed 4 years ago
Hey, sorry for the trouble.
The problem is certainly related to the fact that text
is usually a package that comes with ghc (such packages are usually null
in nixpkgs). For some reason, two of them (text
and stm
) aren't available at all in the stack2nix
output for your project.
I don't have a full solution just yet, but you can work around it by adding the versions of text
and stm
that are in your resolver: lts-14.7
as explicit extra-deps to stack.yaml
:
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,3 +1,6 @@
resolver: lts-14.7
packages:
- .
+extra-deps:
+- text-1.2.3.1
+- stm-2.5.0.0
Then the build will evaluate, and succeed.
I've made a PR with these changes in https://github.com/david-janssen/kmonad/pull/1
Let's not close the issue yet, until we have a proper fix.
No trouble at all.
This fix most certainly fixes the problem. I can run the compilation, it finishes, and it produces a binary I can run both under the NixOS environment in which I compiled it, as well as an Ubuntu in a virtualbox, so I consider this a definite win.
I am not sure why this is 'not a full solution'. Does having to add text
and stm
to extra-deps
compromise the binary in any way? Per your request I will leave this issue open. Is there anything I can do to help to provide you with more information on why my stack2nix
output didn't contain those packages?
Glad it's working for you!
I am not sure why this is 'not a full solution'. Does having to add
text
andstm
toextra-deps
compromise the binary in any way?
No, it's just annoying that one would have to explicitly specify a version that's technically already implied by resolver
. It's unintuitive (and thus you filed this issue).
I must investigate why stack2nix
omits text
and stm
it from the generated nix file when they aren't given explicitly.
@nh2 I have looked into this and my understanding is that we have 2 main causes here:
text
for example.So a proper fix could be in fixing stack2nix
but that one is a legacy thing so is a bit problematic. From the othe side haskell.nix should give a much better coverage (with GHC versions, package revisions, etc.) but its way to large of an effort to fix this issue.
@qrilka Thanks for looking into this!
I have some questions:
stack2nix doesn't deal with boot packages properly, you were the last one adding boot packages in input-output-hk/stack2nix#167 but even that change didn't add
text
for example.
Hmm, that's because none of the sources I linked in https://github.com/input-output-hk/stack2nix/pull/167/files#diff-c3960d8b4ffe3afc0f4919f1df01bcc9R43 says that text
is a boot package. The part in stack only has it in ghcjsBootPackages
, which seems ghcjs specific.
And https://gitlab.haskell.org/ghc/ghc/wikis/commentary/libraries/version-history lists ~none
for text
for current GHCs~ ah that's wrong, I read the table in the wrong direction.
- Stackage moved to use Stack-based builder [...] packages need to be explicitly defined
I'm still not quite sure how exactly it happens. I'm using a pinned stack
so its "resolution mechanism" must be the same. Do you mean there's a concrete change in build-constraints.yaml
that I should look at?
@david-janssen Thanks to the hint by @qrilka I've pushed a fix by making a fix to stack2nix
at https://github.com/input-output-hk/stack2nix/pull/172.
Please try with latest master
, you should no longer need the extra-deps
with that.
@nh2 regarding boot packages Stack has https://github.com/commercialhaskell/stackage-content/blob/master/stack/global-hints.yaml
As for changes in Stackage - it build-constraints.yaml thase are not quite explicit but could be noticed e.g. in https://github.com/commercialhaskell/stackage/pull/4326/files#diff-b42a893675b90dbfa12fe0ce6064f0baR3806 and with text
in lts-13 it was just included automatically as a dependency of other packages, in lts-14 the new Stack curator tool doesn't do this automatic inclusion and global (or boot) packages get pruned (see e.g. https://www.snoyman.com/blog/2019/01/mismatched-global-packages for related rdetials), thus https://github.com/commercialhaskell/lts-haskell/blob/master/lts-14.7.yaml doesn't include text
as a snapshot package but it does include it in system-info.core-packages
.
Hope this makes things a bit more clear.
Can confirm: this fixed everything.
Excuse me if this is me simply not grokking something, but I can't seem to build my little project, which can be found here (including the "default.nix" file I am currently using.: https://github.com/david-janssen/kmonad
I run into "anonymous function at /nix/store/hash-stack2nix-output.nix called without required argument 'text'"
I am not entirely sure how to interpret the output above the error message, but I would half expect to find the 'text' package occuring somewhere around here:
but I can't seem to find it anywhere either.
Am I missing something obvious?