reflex-frp / reflex-platform

A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
713 stars 163 forks source link

nixpkgs-22.05 #790

Closed chrbauer closed 1 month ago

chrbauer commented 1 year ago

The progress of this pull request is slow, because of the huge compile times after each fix, especially if ghc has to be rebuild.

Futhermore sometimes the packages on nixpkgs-22.05 itself needs to be fixed. (For the reflex packages often ali-abrar prepared already and magically a fix.) Or see https://github.com/NixOS/nixpkgs/pull/179006

There are three problems currently:

my builds are still running....

chrbauer commented 1 year ago

My blocking problem with ghc+iconv on android was, that nix-build compiled it for aarch32, but I fixed it for aarch64. I disable aarch32 on android for now. (But it should be fixable, too)

Here is a hint, how the ghc build can be tested:

nix-shell  reflex-platform/default.nix -A nixpkgsCross.android.aarch64.haskell.packages.integer-simple.ghcSplices-8_10.ghc
unpackPhase
cd ghc-8.10.7
configurePhase
make
chrbauer commented 1 year ago

some success: i can build an android app. installation still fails (signing problem)

chrbauer commented 1 year ago

signing works again, can launch the app

chrbauer commented 1 year ago

this works:

./try-reflex
$ cat >hello.hs <<EOF
{-# LANGUAGE OverloadedStrings #-}
import Reflex.Dom
main = mainWidget $ text "Hello, world!"
EOF
$ ghcjs hello.hs
chrbauer commented 1 year ago

Also the build of ghc for armv7 (aarch32). I still have to test the final app

chrbauer commented 1 year ago

The check still fails with "error: infinite recursion encountered, at undefined position"

But I cannot reproduce this locally:

nix-shell -p act
act workflow_dispatch --env "USER=chrbauer"

Any ideas?

Ericson2314 commented 1 year ago

@chrbauer Sorry that this wasn't made clear earlier, but we have been pushing branches working on 22.05 too. We don't want your efforts to be in vain!

chrbauer commented 1 year ago

@chrbauer Sorry that this wasn't made clear earlier, but we have been pushing branches working on 22.05 too. We don't want your efforts to be in vain!

No problem, I learned a lot about the project.

Indeed I was not aware that there are branches for 22.05, too. I only saw 21.05.

If you need something from my branch, feel free to copy it. It is properly working for ghcjs and android, I currently use it to build my reflex dom program. I haven't tried to build an iOS app.

Interesting parts for you could be:

nomeata commented 1 year ago

Is this branch in a usable shape? Trying to use it I get

error: 'androidWithHaskellPackages' at /home/jojo/build/haskell/reflex/reflex-platform/default.nix:271:32 called without required argument 'ghcAndroidAarch32'
nomeata commented 1 year ago

Hmm, using

inherit ghcAndroidAarch64 ghcAndroidAarch32

there does something, but then I am stuck with a build failure in /nix/store/hh76nrq9yffdpwxf612cnpv6708m53dd-armv7a-unknown-linux-androideabi-ghc-integer-simple-8.10.7.drv:

"cp" libraries/base/./GHC/Stack/CCS.hs-boot libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot
cp: cannot create regular file 'libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot': No such file or directory
libraries/integer-simple/ghc.mk:4: libraries/integer-simple/dist-install/build/.depend-v-p-dyn.haskell: No such file or directory
make[1]: *** [libraries/base/ghc.mk:4: libraries/base/dist-install/build/GHC/Stack/CCS.hs-boot] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:128: all] Error 2
chrbauer commented 1 year ago

I haven't seen this error. Can you give more details how it could be reproduced? It's very likely that I overlooked some use case

nomeata commented 1 year ago

To reproduce, check out your reflex-platform somewhere and also check out git@github.com:nomeata/kaleidogen.git, branch android and try to build it with

NIV_OVERRIDE_reflex_platform=/home/jojo/build/haskell/reflex/reflex-platform nix-build -A android.android

(with the override pointing to your reflex-platform checkout).

This works with plain reflex-platform plus https://github.com/reflex-frp/reflex-platform/pull/794, but I get that error above with your branch.

Thanks a lot for looking!

Ericson2314 commented 1 year ago

Indeed I was not aware that there are branches for 22.05, too. I only saw 21.05.

Oh sorry! I got confused, yes we are still trying to do 21.05. We like to march through the Nixpkgs "in order" to basically bite up the breakage in smaller, easier to chew pieces.

chrbauer commented 1 year ago

To reproduce, check out your reflex-platform somewhere and also check out git@github.com:nomeata/kaleidogen.git, branch android and try to build it with

NIV_OVERRIDE_reflex_platform=/home/jojo/build/haskell/reflex/reflex-platform nix-build -A android.android

(with the override pointing to your reflex-platform checkout).

This works with plain reflex-platform plus #794, but I get that error above with your branch.

Thanks a lot for looking!

I pushed your fix with ghcAndroidAarch32. kaleidogen is still building on my machine.... I see in your default.nix, that you you override ghcjs-base. This is not related to the android problem, but for ghcjs it will cause troubles....

One simple idea for you could be to disable armv7a support again. (I dont want to put much effort in this branch, because of the second upgrade path from Ericson2314 et al).

Ericson2314, approaching this problem piece-wise is a very good idea....

nomeata commented 1 year ago

One simple idea for you could be to disable armv7a support again.

Happy to do that, but how would I do it?

chrbauer commented 1 year ago

@nomeata Hm, I just run your nix-build command and the build completed successfully. I could sent you the android-app-release-unsigned.apk file.

How can this be? My system is nixos 22.05.

chrbauer commented 1 year ago

One simple idea for you could be to disable armv7a support again.

Happy to do that, but how would I do it?

Maybe like in this commit: https://github.com/reflex-frp/reflex-platform/pull/782/commits/587ba07fa1f48376b5f52a497208e2e41c8ac4a5

nomeata commented 1 year ago

After a night of building, that worked, and the .apk was accepted by the Google Play store. Great, thanks!

Now looking forward to use an official branch soon again.

BTW, do you have a sense how hard it would be to build an app like this using just nixpkgs, to have less moving parts? For the GHCJS build I already do that, but it is unclear how much reflex-platform provides for the Android support that isn’t in nixpkgs. (To be honest, it is mostly unclear to me what it even takes to make an android app from Haskell on nix…)

nomeata commented 1 year ago

BTW, here is the app, if you want to play with the result of your labor :-) https://play.google.com/store/apps/details?id=de.nomeata.kaleidogen

chrbauer commented 1 year ago

After a night of building, that worked, and the .apk was accepted by the Google Play store. Great, thanks!

Now looking forward to use an official branch soon again.

BTW, do you have a sense how hard it would be to build an app like this using just nixpkgs, to have less moving parts? For the GHCJS build I already do that, but it is unclear how much reflex-platform provides for the Android support that isn’t in nixpkgs. (To be honest, it is mostly unclear to me what it even takes to make an android app from Haskell on nix…)

Not sure how difficult it would be, but I would wish that we combine our efforts in building one powerful, up-to-date reflex driven platform. There is still a lot to do, e.g. for sharing my oauth2 infrastructure with web/app I just load the index.html instead of the android assets from a remote URL, so that the backend could do the required redirects. (The former approach is hard coded in the haskell activity). I would like to have more widget support (iconicframework seems to be a good option). Also I see the the ghc team is working on a new javascript and wasm backends.

Tried you app, very nice. (And as a good tester I have to report that the back button is not working on my phone ;-)

nomeata commented 1 year ago

Tried you app, very nice.

Thanks! Did it run stable for you?

(And as a good tester I have to report that the back button is not working on my phone ;-)

What would you expect it to do?