diff --git a/default.nix b/default.nix index 1f292b7..5aa986f 100644 --- a/default.nix +++ b/default.nix @@ -1,9 +1,9 @@ -{ mkDerivation, base, generics-sop, hpack, lib, zlib }: +{ mkDerivation, base, generics-sop, hpack, lib, zlib, web3 }: mkDerivation { pname = "pixura-contracts"; version = "0.3.0.0"; src = ./.; - libraryHaskellDepends = [ base generics-sop ]; + libraryHaskellDepends = [ base generics-sop web3 ]; libraryPkgconfigDepends = [ zlib ]; libraryToolDepends = [ hpack ]; prePatch = "hpack"; diff --git a/flake.lock b/flake.lock index b868141..b7c9b7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,12 +1,44 @@ { "nodes": { + "hs-web3": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1661984067, + "narHash": "sha256-j+BzdnBFjS8qKjAqATzMi7/bxW8jX0/eh4Rv+yHstO8=", + "ref": "master", + "rev": "8f7459b834f7f42e5570e0004fe1fc6d4f7c6c9a", + "revCount": 631, + "type": "git", + "url": "ssh://git@github.com/superrare/hs-web3" + }, + "original": { + "id": "hs-web3", + "type": "indirect" + } + }, "nixpkgs": { "locked": { - "lastModified": 1657208011, - "narHash": "sha256-BlIFwopAykvdy1DYayEkj6ZZdkn+cVgPNX98QVLc0jM=", + "lastModified": 1661353537, + "narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0e304ff0d9db453a4b230e9386418fd974d5804a", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1661353537, + "narHash": "sha256-1E2IGPajOsrkR49mM5h55OtYnU0dGyre6gl60NXKITE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2770cc0b1e8faa0e20eb2c6aea64c256a706d4f2", + "rev": "0e304ff0d9db453a4b230e9386418fd974d5804a", "type": "github" }, "original": { @@ -16,7 +48,8 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "hs-web3": "hs-web3", + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index b2b50f1..1b3f9aa 100644 --- a/flake.nix +++ b/flake.nix @@ -1,20 +1,28 @@ { # inspired by: https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications description = "A Hello World in Haskell with a dependency and a devShell"; - inputs.nixpkgs.url = "nixpkgs"; - outputs = { self, nixpkgs }: + inputs = + { + nixpkgs.url = "nixpkgs"; + hs-web3 = + { url = "hs-web3"; + inputs.nixpkgs.url = "nixpkgs"; + }; + }; + outputs = { self, nixpkgs, hs-web3 }: let supportedSystems = [ "x86_64-linux" "x86_64-darwin" ]; forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; - overlays = [ self.overlay ]; + overlays = [ (self.overlay system) ]; }); in { - overlay = (final: prev: { - pixura-contracts = final.haskell.packages.ghc923.callPackage (import ./default.nix) { + overlay = (system: final: prev: { + pixura-contracts = final.haskell.packages.ghc924.callPackage (import ./default.nix) { inherit (final) zlib; + inherit (hs-web3.packages.${system}) web3; }; }); packages = forAllSystems (system: { @@ -22,17 +30,19 @@ }); defaultPackage = forAllSystems (system: self.packages.${system}.pixura-contracts); checks = self.packages; - devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskell.packages.ghc923; - in haskellPackages.shellFor { - packages = p: [self.packages.${system}.pixura-contracts]; - withHoogle = true; - buildInputs = with haskellPackages; [ - haskell-language-server - ghcid - cabal-install - ]; - # Change the prompt to show that you are in a devShell - # shellHook = "export PS1='\\e[1;34mdev > \\e[0m'"; - }); - }; + devShell = forAllSystems (system: + let haskellPackages = nixpkgsFor.${system}.haskell.packages.ghc924; + in haskellPackages.shellFor + { + packages = p: [self.packages.${system}.pixura-contracts]; + withHoogle = true; + buildInputs = with haskellPackages; + [ + haskell-language-server + cabal-install + ]; + # Change the prompt to show that you are in a devShell + # shellHook = "export PS1='\\e[1;34mdev > \\e[0m'"; + }); + }; } diff --git a/package.yaml b/package.yaml index 4dd7521..4ca67aa 100644 --- a/package.yaml +++ b/package.yaml @@ -48,7 +48,7 @@ default-extensions: dependencies: - base >=4.7 && <5 - generics-sop - - web3 + - web3-ethereum library: source-dirs: hs-contracts/src ghc-options: -Wall -Werror diff --git a/pixura-contracts.cabal b/pixura-contracts.cabal index b1bd549..a6fbd87 100644 --- a/pixura-contracts.cabal +++ b/pixura-contracts.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack @@ -91,5 +91,5 @@ library build-depends: base >=4.7 && <5 , generics-sop - , web3 + , web3-ethereum default-language: Haskell2010 diff --git a/stack.yaml b/stack.yaml index bf1b1d4..c2e02f7 100644 --- a/stack.yaml +++ b/stack.yaml @@ -7,6 +7,18 @@ packages: allow-newer: true extra-deps: - - git: https://github.com/Pixura/hs-web3 + - git: https://github.com/superrare/hs-web3 commit: 0713a7664dcb768af311de7a9940906fa5c29f8a + subdirs: + - packages/bignum + - packages/crypto + - packages/ethereum + - packages/hexstring + - packages/ipfs + - packages/jsonrpc + - packages/polkadot + - packages/provider + - packages/scale + - packages/solidity + - packages/web3 - relapse-1.0.0.0@sha256:b89ea23189e07f377be4e2a4deccf3d6ba7f547ed8ad77e27b35d78801efd81c