Closed nomeata closed 3 years ago
A work-around is to compile the haskeline
package with -f-readline
; I am not sure which features are lost this way.
Check out commit 76d2cd3c46fabb55419de0fdb7cb7af5ac687ca8. All that was needed was https://github.com/nh2/static-haskell-nix/blob/76d2cd3c46fabb55419de0fdb7cb7af5ac687ca8/survey/default.nix#L629-L634
I could then build it with
NIX_PATH=nixpkgs=https://github.com/NixOS/nixpkgs/archive/88ae8f7d.tar.gz nix-build --no-link survey/default.nix -A haskellPackages.tttool
Since I have commited this, you can now build it the same way, and I have also uploaded it to the cachix.
(If you add tttool
to Stackage, you will get that for free without an entry as I have committed now.)
For clarity, it is also possible to do this without adding code to static-haskell-nix
, by importing it instead; example: https://github.com/nh2/static-haskell-nix/blob/76d2cd3c46fabb55419de0fdb7cb7af5ac687ca8/static-stack/default.nix#L38-L42
I've also uploaded the static result: https://github.com/nh2/static-haskell-nix/releases/tag/tttool-static
7.7 MB uncompressed.
In other words, because you use pkgs.pkgsMusl
instead of my overridden haskellPackages
, you likely don't have any of my fixes to build stuff statically, including the one for tinfo
.
Thanks for the fix and explanation!
I also managed to build it statically using haskell.nix
, and since that also gives me windows builds, I will probably use that for now. But using plain nixpks eventually (with your work) would be nice!
@nomeata Can plain nixpkgs not give Windows builds? Must one switch to haskell.nix
for that?
Haven't tried recently, back then they had a fair amount of patches for cross compilation onto Windows that were not in upstream nixpkgs yet.
I believe that all tinfo
/ ncurses
issues should be fixed with PR #98.
I am trying to build https://travis-ci.org/entropia/tip-toi-reveng/ statically using these instructions, and I made good progress by pinning
nixpkgs
to version https://github.com/NixOS/nixpkgs/commit/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac (which is the one mentioned in theREADME
) and then bulidingpkgs.pkgsMusl.haskell.packages.ghc843.tttool
.And indeed, as long as I stub out uses of
TemplateHaskell
in my program (it it expected that this is needed?), it builds… almost: It fails linkingBlindly cargo-culting the example scotty app, I tried adding the following to my
project.nix
but it did not make a difference (and there was already a
--extra-lib-dirs=/nix/store/1xwbnc903gymfi99zpvj8mdp5601yqz6-ncurses-6.1/lib
commde line argument passed automatically somehow).Is it maybe dubious that https://github.com/NixOS/nixpkgs/blob/2c07921cff84dfb0b9e0f6c2d10ee2bfee6a85ac/pkgs/development/libraries/ncurses/default.nix starts with