build: nix: shell: Add shell-ide, shell with ghcide
fix: CADETStream: c'GNUNET_MQ_send from single thread
Revert "feat: CADET: Clean up in withCreateChannel"
Build GNUnet applications from the well-typed concurrent comfort of your Haskell.
This project is organized in three layers:
network-transport-cadet (not there yet) | plug-in n-t implementation | Network.Transport.* gnunet-hs | user-friendly library | Network.GNUnet.* bindings-gnunet | autogenerated bindings (in c2hsc/bindings-DSL) | Bindings.GNUnet.* GNUnet | upstream | gnunet_*_service.h
To see how to use the library, the primary destination is ./examples
. Also see tests at ./gnunet-hs/test
and a netcat at ./cadetcat
.
Here's an impression:
conf <- G.setup "sampleapp" "gnunet.conf" G.NoLog
flip runReaderT conf $ G.run $
CADET.withCadet $ \c ->
CADET.withConnection c "0E497SHHFSR09123Z8BZYP19DAMBS5K8HX9PQWV8Q8NQRH9B0VN0" (G.hash "myPort") $
CADET.send "ola!"
Note we only test on Linux at the moment.
To work on the library itself, here's how you check things work:
nix-shell
cd gnunet-hs
cabal new-run gnunet-hs:test
IDE integration is available at shell-ide.nix
.
Decide what from GNUnet's API at gnunet/src/include/*.h
you want
Hook up bindings:
c2hsc
on the header (details in ./bindings-gnunet
), add artifact to cabal as exposed modulepkgconfig-depends
)Build a nicer interface, some suggestions:
gnunet
to see how it's usedbindings-gnunet
unless gnunet-hs
is incompleteasync
.One complex part of the project is integration between GHC RTS and GNUnet's scheduler, at Network.GNUnet.SchedulerIntegration
. We basically implement GNUNET_SCHEDULER_Driver
in terms of GHC.Event
. It mostly works at the moment.
If you'd like to help make it work 💯:
ghc-events-analyze
useful+RTS -v
streams eventlog to stderrgdb
is your friendphoityne-vscode
might or might not be usefulBy default, GNUnet is supplied via nix. If you wish to have incremental local builds of GNUnet, peruse contrib/localgnunet.sh
(consider invoking with direnv
).