CardanoSolutions / kupo

🐹 Fast, lightweight & configurable chain-index for Cardano.
https://cardanosolutions.github.io/kupo/
Mozilla Public License 2.0
119 stars 29 forks source link

failing to build #4

Closed CatspersCoffee closed 2 years ago

CatspersCoffee commented 2 years ago

failing to build from source with:

 nix --experimental-features nix-command build -f default.nix kupo.components.exes.kupo

Linux / Ubuntu 20.04 nix (Nix) 2.6.1

output and logs.

https://gist.github.com/CatspersCoffee/292c0025dae791bf65c3717a12901071

https://gist.github.com/CatspersCoffee/0a513160f4d452b6f18576d4c858e9cd

CatspersCoffee commented 2 years ago

Thought i was missing golang. but doesn't look to be the case

KtorZ commented 2 years ago

Hey, what about not enabling --experimental-features ? This should not be needed and may be causing issues here.

CatspersCoffee commented 2 years ago

Hi,

if i use the command:

nix build -f default.nix kupo.components.exes.kupo

i immediately get:

error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override

hence why i added --experimental-features. So maybe my Nix config is not correct?

KtorZ commented 2 years ago

That is odd.. Can you try:

nix-build -A kupo.components.exes.kupo

(notice the dash, it's nix-build not nix build)

CatspersCoffee commented 2 years ago

using nix-build definitely doesn't work for me, maybe its my config:

error: unrecognised flag '-f'
Try 'nix-build --help' for more information.

I did however take a look into my ~/.config/nix/nix.config file and adjusted it to:

substituters        = https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
experimental-features = nix-command flakes

and used nix build -f default.nix kupo.components.exes.kupo as suggested in your documentation to build kupo.

I would probably consider this a (my) nix config issue rather than an issue with kupo.

Thanks for you help :-)

CatspersCoffee commented 2 years ago

I guess the question is, should kupo be able to be built without the iohk binaries and/or the experimental-features = nix-command flakes ?

KtorZ commented 2 years ago

A little disclaimer: I do not like Nix very much and, the less Nix I do, the better I live 😬; yet, the Nix pipeline is the only sane way to produce statically linked Haskell binary, so I got to bear with it.

I am saying this because indeed, I am not looking into supporting flakes. I did in another project for a while (CardanoSolutions/ogmios) and it was a nightmare to maintain and keep up. Too many moving parts and scripts on top of scripts to get things working.

The current Nix setup in the project is pretty simple, but it does require the IOHK overlay (because the project ultimately relies on IOHK libraries such as cardano-ledger). I do not know what's going on with your Nix setup to be honest. It is odd.

If building from sources is really a wish of yours, then stack is also an option which I use for development. It should work out of the box and will be sufficient to produce dynamically linked executable (and, you'll have to have the relevant libraries installed on your system, so openssl and sqlite mainly).

CatspersCoffee commented 2 years ago

Hi,

Thanks for the reply. Yes i have to agree with you on nix, sometimes it can be fussy. my nix config was fairly simple, it was a more-or-less fresh system. I figured that the project did rely on cardano ledger and therefore iohk libs.

What i think i might do just for the exercise, is attempt stack as you suggest on a clean VM and see how that goes also.

CatspersCoffee commented 2 years ago

Hi KtorZ, just as an aside, is there a config or build option to get kupo to listen on port 1442, 0.0.0.0 ? i.e., not as localhost

KtorZ commented 2 years ago

Yes, there are two options --port and --host just for that. Those are visible via the --help manual.

Did you manage to build in the end?

CatspersCoffee commented 2 years ago

Awesome thanks! Ok so; managed to build kupo using nix with the iohk binaries using the nix config from above... and also, spun up a clean VM and managed to build with stack.

I'll close off this issue now, thanks again