sidan-lab / plutus-cborhex-automation

A Haskell package for creating RESTful API endpoints for dynamic parameterized Cardano Plutus script.
15 stars 3 forks source link

automate build #18

Closed aleeusgr closed 1 year ago

aleeusgr commented 1 year ago

currently we do cd plutus-apps git checkout nix-shell cd <name> cabal update cabal run

our goal is to get an executable by running nix-build

Later use nix to build docker container

aleeusgr commented 1 year ago

https://blog.ocharles.org.uk/blog/posts/2014-02-04-how-i-develop-with-nixos.html http://blog.tpleyer.de/posts/2019-07-10-How-Nix-provides-GHC-with-packages.html

aleeusgr commented 1 year ago

wip solution: https://github.com/aleeusgr/hello-haskell-ci/issues/4

aleeusgr commented 1 year ago

https://input-output-hk.github.io/haskell.nix/dev/installing-nix-tools.html https://input-output-hk.github.io/haskell.nix/tutorials/getting-started

nix-build -A example-validator

trace: WARNING: No sha256 found for source-repository-package https://github.com/input-output-hk/plutus-apps ref=v1.0.0-alpha1 rev=(unspecified) download may fail in restricted mode (hydra) fatal: couldn't find remote ref refs/heads/v1.0.0-alpha1 error: program 'git' failed with exit code 128

niv add input-output-hk/plutus-apps -n plutus-apps

trace: WARNING: No sha256 found for source-repository-package https://github.com/input-output-hk/cardano-wallet ref=(unspecified) rev=18a931648550246695c790578d4a55ee2f10463e download may fail in restricted mode (hydra) error: fetchTree argument 'ref' is null while a string, Boolean or integer is expected (use '--show-trace' to show detailed location information)

aleeusgr commented 1 year ago

https://input-output-hk.github.io/haskell.nix/tutorials/source-repository-hashes.html

I need to update provide tag --sha256: in project.cabal like so: https://github.com/SIDANWhatever/plutus-cborhex-automation/blob/dca7e78bad6d62838582acf5c3bb40e0d2c2898b/example-validator/cabal.project#L78

you can get tags by using nix-prefetch-github

aleeusgr commented 1 year ago

testing with ghc8104, 924(default), 904

Same error, 8104 builds for a rather long time.

error: builder for '/nix/store/69rv82cxc4z0pjd8bbs71kxyvml4wcwi-haskell-project-plan-to-nix-pkgs.drv' failed with exit code 1; last 10 log lines: Error: cabal: Could not resolve dependencies: [0] trying: Win32-network-0.1.0.0 (user goal) [1] trying: base-4.14.1.0/installed-4.14.1.0 (dependency of Win32-network) [2] next goal: example-validator (user goal) [2] rejecting: example-validator-0.1.0.0 (conflict: base==4.14.1.0/installed-4.14.1.0, example-validator => base^>=4.14.3.0) [__2] fail (backjumping, conflict set: base, example-validator) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: base, example-validator, Win32-network

For full logs, run 'nix log /nix/store/69rv82cxc4z0pjd8bbs71kxyvml4wcwi-haskell-project-plan-to-nix-pkgs.drv'. (use '--show-trace' to show detailed location information)

nix log /nix/store/69rv82cxc4z0pjd8bbs71kxyvml4wcwi-haskell-project-plan-to-nix-pkgs.drv > log.nix, same

aleeusgr commented 1 year ago
  1. in default.nix set compiler-nix-name = "ghc8107";
  2. in example-validator.cabal set cabal-version: 3.6

error: https://github.com/input-output-hk/haskell.nix/issues/1767

aleeusgr commented 1 year ago

more tests: nix-shell builds for me. It was building empty shell, run nix-shell default.nix | shell.nix however inside nix-shell, cabal run fails on Win32

aleeusgr commented 1 year ago

Idea: change tag on cardano-wallet | its dependencies

testing:

source-repository-package 
  2     type: git
  1     location: https://github.com/input-output-hk/cardano-wallet
104     --sha256: 4KsuOyNO8XEMIvqiA0LdLZAJX8OFVizuxETGfayZHDQ=
  1     tag: v2022-10-06

Error:

HEAD is now at 984f465 Minimal Repo For Haskell.Nix /build/tmp.ZKufJYLy0Y/dist-newstyle/src/wsk38zq88-19f4faaf7800b43d/lib/shelley: getDirectoryContents:openDirStream: does not exist (No such file or directory) error: builder for '/nix/store/w8isxjf54c7wbyf1llsjs48s6j920wgc-haskell-project-plan-to-nix-pkgs.drv' failed with exit code 1; last 10 log lines: HEAD is now at 37aaab0 Minimal Repo For Haskell.Nix Cloning into '/build/tmp.ZKufJYLy0Y/dist-newstyle/src/wsk38zq88-19f4faaf7800b43d'... remote: Enumerating objects: 1865, done. remote: Counting objects: 100% (1865/1865), done. remote: Compressing objects: 100% (1711/1711), done. remote: Total 1865 (delta 136), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (1865/1865), 4.81 MiB | 6.34 MiB/s, done. Resolving deltas: 100% (136/136), done. HEAD is now at 984f465 Minimal Repo For Haskell.Nix /build/tmp.ZKufJYLy0Y/dist-newstyle/src/wsk38zq88_-19f4faaf7800b43d/lib/shelley: getDirectoryContents:openDirStream: does not exist (No such file or directory) For full logs, run 'nix log /nix/store/w8isxjf54c7wbyf1llsjs48s6j920wgc-haskell-project-plan-to-nix-pkgs.drv'. (use '--show-trace' to show detailed location information)