Skip to content

Commit

Permalink
Update to new version of hs-web3 and GHC 9.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenAstudillo committed Sep 1, 2022
1 parent 66b3916 commit 12acbd7
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 11 deletions.
10 changes: 10 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ mkDerivation, base, generics-sop, lib, zlib, web3-ethereum }:
mkDerivation {
pname = "pixura-contracts";
version = "0.3.0.0";
src = ./.;
libraryHaskellDepends = [ base generics-sop web3-ethereum ];
libraryPkgconfigDepends = [ zlib ];
homepage = "https://github.com/Pixura/pixura-contracts#readme";
license = lib.licenses.bsd3;
}
58 changes: 58 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
# 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";
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 system) ];
});
in
{
overlay = (system: final: prev: {
pixura-contracts = final.haskell.packages.ghc924.callPackage (import ./default.nix) {
inherit (final) zlib;
inherit (hs-web3.packages.${system}) web3-ethereum;
};
});
packages = forAllSystems (system: {
pixura-contracts = nixpkgsFor.${system}.pixura-contracts;
});
defaultPackage = forAllSystems (system: self.packages.${system}.pixura-contracts);
checks = self.packages;
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'";
});
};
}
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 38 additions & 3 deletions pixura-contracts.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12

-- This file has been generated from package.yaml by hpack version 0.33.0.
-- This file has been generated from package.yaml by hpack version 0.34.7.
--
-- see: https://github.com/sol/hpack
--
Expand Down Expand Up @@ -57,10 +57,45 @@ library
Paths_pixura_contracts
hs-source-dirs:
hs-contracts/src
default-extensions: ApplicativeDo BangPatterns ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable DerivingStrategies EmptyCase ExistentialQuantification FlexibleContexts FlexibleInstances FunctionalDependencies GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures LambdaCase MultiParamTypeClasses MultiWayIf NamedFieldPuns OverloadedStrings PatternSynonyms RankNTypes RecordWildCards ScopedTypeVariables StandaloneDeriving TupleSections TypeApplications TypeFamilies TypeFamilyDependencies TypeOperators
default-extensions:
ApplicativeDo
BangPatterns
ConstraintKinds
DataKinds
DefaultSignatures
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DerivingStrategies
EmptyCase
ExistentialQuantification
FlexibleContexts
FlexibleInstances
FunctionalDependencies
GADTs
GeneralizedNewtypeDeriving
InstanceSigs
KindSignatures
LambdaCase
MultiParamTypeClasses
MultiWayIf
NamedFieldPuns
OverloadedStrings
PatternSynonyms
RankNTypes
RecordWildCards
ScopedTypeVariables
StandaloneDeriving
TupleSections
TypeApplications
TypeFamilies
TypeFamilyDependencies
TypeOperators
ghc-options: -Wall -Werror
build-depends:
base >=4.7 && <5
, generics-sop
, web3
, web3-ethereum
default-language: Haskell2010
29 changes: 29 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:

let

inherit (nixpkgs) pkgs;

f = { mkDerivation, base, generics-sop, hpack, lib, web3 }:
mkDerivation {
pname = "pixura-contracts";
version = "0.3.0.0";
src = ./.;
libraryHaskellDepends = [ base generics-sop ];
libraryToolDepends = [ hpack ];
prePatch = "hpack";
homepage = "https://github.com/Pixura/pixura-contracts#readme";
license = lib.licenses.bsd3;
};

haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};

variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;

drv = variant (haskellPackages.callPackage f {});

in

if pkgs.lib.inNixShell then drv.env else drv
22 changes: 19 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
resolver: lts-14.6
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/7/28.yaml

packages:
- "."

allow-newer: true

extra-deps:
- git: https://github.com/Pixura/hs-web3
commit: 175ca55de9be31054a8246d8c5ed8d7ce7813d83
- git: https://github.com/superrare/hs-web3
commit: ac45f1fe34c2290739dcb7603a075c55385c2a51
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
9 changes: 5 additions & 4 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ packages:
commit: 175ca55de9be31054a8246d8c5ed8d7ce7813d83
snapshots:
- completed:
size: 524127
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/6.yaml
sha256: dc70dfb45e2c32f54719819bd055f46855dd4b3bd2e58b9f3f38729a2d553fbb
original: lts-14.6
sha256: 83cd17c52003e19611bd84c678f78fb0d98828ab8bc300a0b53ff2ae4f894ac5
size: 617444
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/7/28.yaml
original:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/7/28.yaml

0 comments on commit 12acbd7

Please sign in to comment.