Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/web3 1.0.0.0 #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: [email protected]:superrare/hs-web3.git
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
Loading