Hi Everyone
I am attempting to distribute a Haskell library using nix flakes but, after many attempts, I was not able to find a solution.
Context
I am trying to create a nix flake for an Haskell library I am developing to interface the CLI of another project called P2PRC. I packaged the parent nix flake using the standard “gomod2nix”.
The parent project is setup in a way in which any front-end client is developed in a subfolder called “Bindings”. I am developing the Haskell library there.
This is a middle level library intended to define orchestration rules for the P2PRC protocol. You can have a peek at the documentation I wrote to get an understanding of the functionality, if you are curious.
Goal
I want to allow people to use a nix flake to import the Haskell library so that they can do an import the library into their own Haskell cabal/stack project.
Additionally, I would like to be able to reference the parent flake as a “runtime dependency” so that I can call the P2PRC binary from the environment.
I have read the documentation for nix and nix flake, tried many different approaches, and I am now a bit confused on how to acomplish this.
Importing parent library
I am able to reference the package above when developing and running the package locally but I face some issues when referencing the parent package remotely?
I want to use this reference because it will match the parent package version automatically. Is this the correct way to reference another nix flake module? Should I just point to the remote github repo?
Haskell library
Inside the cabal I reference the Haskell library. I want to expose this to a remote flake file automatically (nix shell/build/run).
What is the best way to allow the import to another Haskell nix flake project?
Many thanks in advance!