cosmos.nix icon indicating copy to clipboard operation
cosmos.nix copied to clipboard

feat: more automated and universal cosmos app go builder

Open dzmitry-lahoda opened this issue 1 year ago • 2 comments
trafficstars

https://github.com/informalsystems/cosmos.nix/pull/201#issuecomment-1879667726

copy paste out of comment:

pkgs.cosmos.lib.buildGoCosmosApp {   # GoCosmosApp because there are non Go already
  name = Required
  version = Optional evaluated from go.mod or set
  deps = Required vendroHash then build via buildGoModule else if gomod2nix file build via gomod2nix
  buildInputs + prefixup = Optional if not contains wasmd and go.sum contains wasmd and version of wasmd parsed make wasmd work; will work with EVM/SVM machines too (Evmos/Sei)
  goVersion = Optional : parsed from go.mod
  rev = Optional: if set  use it, if not set check src.rev, if not set and ser.rev empty trace warn non set 
  ..rest-args passed to underlying builder as is - so people canfixup and extend as needed (SOLID)
 }

here is parser for go.mod:

https://github.com/nix-community/gomod2nix/blob/master/builder/parser.nix

go.sum is regexable

dzmitry-lahoda avatar Jan 06 '24 12:01 dzmitry-lahoda

ultimate builder app.

love this idea

fully forgot to set any version things. so export of some well known attrs in lib could be useful to handle nix native chains. also was thinking about to read out version from go.mod. so really app version and wasmd input/fixup could be automated from parsing (and in future any well known cpp lib). so l need to set them directly, along with consensus engine.

This is a great idea, I wonder if we should write a small rust lib to do the parsing. The nix parsing logic is a bit unwieldy. Hopefully we could use an external lib without IFD? I am going to make an issue about this.

(reposting here to move the conversation)

JonathanLorimer avatar Jan 06 '24 16:01 JonathanLorimer

allow-unsafe-native-code-during-evaluation nix can be even extended with functions

dzmitry-lahoda avatar Sep 06 '24 08:09 dzmitry-lahoda