From 209bf60e2093f7296e77bad73e120ecaa2633180 Mon Sep 17 00:00:00 2001 From: dxo Date: Tue, 26 Sep 2023 14:25:47 +0200 Subject: [PATCH 1/5] flake-experiments --- flake.lock | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 39 ++++++++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..711b222 --- /dev/null +++ b/flake.lock @@ -0,0 +1,80 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1693611461, + "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "haskell-flake": { + "locked": { + "lastModified": 1694478711, + "narHash": "sha256-zW/saV4diypxwP56b8l93Nw8fR7tXLbOFku2I+xYCxU=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "ddc704f3f62d3d3569ced794b534e8fd065c379c", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "haskell-flake", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1695360818, + "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1693471703, + "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "haskell-flake": "haskell-flake", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..43f4e52 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +# file: flake.nix +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + haskell-flake.url = "github:srid/haskell-flake"; + }; + + outputs = inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; + imports = [ + inputs.haskell-flake.flakeModule + ]; + perSystem = { self', system, lib, config, pkgs, ... }: { + haskellProjects.default = { + basePackages = pkgs.haskell.packages.ghc927; + + settings = { + # TODO: whats going on here? + poly.check = false; + }; + + # What should haskell-flake add to flake outputs? + autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell + }; + + devShells.default = pkgs.mkShell { + name = "open games devshell"; + inputsFrom = [ + config.haskellProjects.default.outputs.devShell + ]; + nativeBuildInputs = with pkgs; [ + # other development tools. + ]; + }; + }; + }; +} From d5f5394306e825a04ca46ad18462403e91301a1b Mon Sep 17 00:00:00 2001 From: dxo Date: Tue, 26 Sep 2023 16:37:54 +0200 Subject: [PATCH 2/5] flake: act builds now --- flake.lock | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++---- flake.nix | 26 +++++++++++------- 2 files changed, 90 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 711b222..1ab9d04 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,25 @@ { "nodes": { + "act": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1685616523, + "narHash": "sha256-fERVRwJxxvOSR+JfvcCXOa5GHrGtYkYHB/Ul2d7gLE8=", + "owner": "ethereum", + "repo": "act", + "rev": "52e99daf3121a4e6a6cb28255e862cf8e83cf4cd", + "type": "github" + }, + "original": { + "owner": "ethereum", + "repo": "act", + "rev": "52e99daf3121a4e6a6cb28255e862cf8e83cf4cd", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -18,6 +38,24 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "haskell-flake": { "locked": { "lastModified": 1694478711, @@ -35,16 +73,15 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695360818, - "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", + "lastModified": 1684164265, + "narHash": "sha256-ZqNSKSQM12040taiRvSgqwUCPlN1qZAw6nYniYuY1hs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", + "rev": "872c89e5a754a04058b4531e54897db5ca734100", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -67,11 +104,43 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1695360818, + "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { + "act": "act", "flake-parts": "flake-parts", "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 43f4e52..f521d06 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,15 @@ -# file: flake.nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; + act.url = "github:ethereum/act/52e99daf3121a4e6a6cb28255e862cf8e83cf4cd"; + act.flake = false; }; outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { - systems = [ "x86_64-linux" ]; + systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]; imports = [ inputs.haskell-flake.flakeModule ]; @@ -16,23 +17,28 @@ haskellProjects.default = { basePackages = pkgs.haskell.packages.ghc927; + packages = { + act.source = "${inputs.act}/src"; + }; + settings = { - # TODO: whats going on here? - poly.check = false; + act.extraTestToolDepends = [pkgs.z3]; + poly = { + # TODO: what's going on here? why are these tests failing? where is this dep even coming from? + check = false; + broken = false; + }; }; - # What should haskell-flake add to flake outputs? - autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell + # send everything but the devShell to the main flake outputs + autoWire = [ "packages" "apps" "checks" ]; }; devShells.default = pkgs.mkShell { - name = "open games devshell"; + name = "og devshell"; inputsFrom = [ config.haskellProjects.default.outputs.devShell ]; - nativeBuildInputs = with pkgs; [ - # other development tools. - ]; }; }; }; From bf8a679c45b3cd9c60d40958d3d5bd36b25c5fe6 Mon Sep 17 00:00:00 2001 From: dxo Date: Tue, 26 Sep 2023 16:38:08 +0200 Subject: [PATCH 3/5] opengames builds now --- act/Act/TH/Extractor.hs | 3 --- act/EVM/TH.hs | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/act/Act/TH/Extractor.hs b/act/Act/TH/Extractor.hs index 5f41e2f..dd8b4f9 100644 --- a/act/Act/TH/Extractor.hs +++ b/act/Act/TH/Extractor.hs @@ -6,13 +6,10 @@ module Act.TH.Extractor (argumentExtractorName, generateExtractMethods) where import Act.Prelude import Act.Utils -import Data.Data import Data.List import Language.Haskell.TH.Syntax as TH import Syntax.Annotated -deriving instance Data AbiType - -- Given each method in the contract we need to know how to extract the arguments from the -- arguments' array. for this we create a partial top-level function which matches -- on the argument array and return the correct number of argument in its expected type diff --git a/act/EVM/TH.hs b/act/EVM/TH.hs index fff6d09..9dd987c 100644 --- a/act/EVM/TH.hs +++ b/act/EVM/TH.hs @@ -122,8 +122,7 @@ emptyVM contracts = { contracts = Map.fromList (fmap (fmap bytecodeToContract) contracts), chainId = 0, storage = EmptyStore, - origStorage = mempty, - sha3Crack = mempty + origStorage = mempty } bytecodeToContract :: ByteString -> Contract From 95663c3cf25d217a5ff017f12d0b662c46baa93f Mon Sep 17 00:00:00 2001 From: dxo Date: Tue, 26 Sep 2023 16:38:20 +0200 Subject: [PATCH 4/5] add .envrc --- .envrc | 1 + .gitignore | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 913806e..6745eee 100644 --- a/.gitignore +++ b/.gitignore @@ -162,3 +162,6 @@ TSWLatexianTemp* .DS_Store .stack-work/ dist-newstyle/ + +# direnv +.direnv/ From 86e61e12f613fcccffff9965b6596d897a2e7695 Mon Sep 17 00:00:00 2001 From: dxo Date: Tue, 26 Sep 2023 17:53:24 +0200 Subject: [PATCH 5/5] flake: fix nix build --- .gitignore | 4 ++++ flake.nix | 3 +++ open-games-hs.cabal | 1 + 3 files changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index 6745eee..3844149 100644 --- a/.gitignore +++ b/.gitignore @@ -165,3 +165,7 @@ dist-newstyle/ # direnv .direnv/ + +# nix +result +result/ diff --git a/flake.nix b/flake.nix index f521d06..389ebd7 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,9 @@ autoWire = [ "packages" "apps" "checks" ]; }; + packages.default = self'.packages.open-games-hs; + apps.default = self'.apps.open-games-hs; + devShells.default = pkgs.mkShell { name = "og devshell"; inputsFrom = [ diff --git a/open-games-hs.cabal b/open-games-hs.cabal index 21e2f8d..41ac12a 100644 --- a/open-games-hs.cabal +++ b/open-games-hs.cabal @@ -16,6 +16,7 @@ license-file: LICENSE build-type: Simple extra-source-files: README.md + amm.act library exposed-modules: