Skip to content

Commit

Permalink
Add flake support
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenAstudillo committed Sep 1, 2022
1 parent 50d5d68 commit 7bac6a8
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 15 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 = "rarest-token";
version = "0.1.0.0";
src = ./.;
libraryHaskellDepends = [ base generics-sop web3-ethereum ];
libraryPkgconfigDepends = [ zlib ];
homepage = "https://github.com/Pixura/rarest-token#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.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
# 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: {
rarest-token = final.haskell.packages.ghc924.callPackage (import ./default.nix) {
inherit (final) zlib;
inherit (hs-web3.packages.${system}) web3-ethereum;
};
});
packages = forAllSystems (system: {
rarest-token = nixpkgsFor.${system}.rarest-token;
});
defaultPackage = forAllSystems (system: self.packages.${system}.rarest-tokens);
checks = self.packages;
devShell = forAllSystems (system: let haskellPackages = nixpkgsFor.${system}.haskell.packages.ghc924;
in haskellPackages.shellFor {
packages = p: [self.packages.${system}.rarest-token];
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'";
});
};
}
4 changes: 2 additions & 2 deletions 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
ghc-options: -Wall -Werror
4 changes: 2 additions & 2 deletions rarest-token.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.34.4.
-- This file has been generated from package.yaml by hpack version 0.34.7.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -71,5 +71,5 @@ library
build-depends:
base >=4.7 && <5
, generics-sop
, web3
, web3-ethereum
default-language: Haskell2010
29 changes: 18 additions & 11 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
resolver: lts-18.28
resolver:
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2022/7/28.yaml

allow-newer: true

packages:
- "."

extra-deps:
- web3-ethereum
- 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
- protolude-0.3.2
- web3-1.0.0.0
- web3-polkadot-1.0.0.0
- web3-provider-1.0.0.0
- web3-solidity-1.0.0.0
- web3-bignum-1.0.0.0
- web3-crypto-1.0.0.0
- animalcase-0.1.0.2@sha256:d7b80c3130c68d7ce8ddd9782588b2c4dd7da86461f302c54cc4acddf0902b51,1015
- jsonrpc-tinyclient-1.0.0.0@sha256:7ce2f20d45648bfb08896c99f41e78a9b08c6ac846235977d1e925e1c7817753,1662
- memory-hexstring-1.0.0.0@sha256:397a423dfd361b75cf73e99613a55b1fa87b7551edf46ea43d1f7e9f5d07b924,1677
- scale-1.0.0.0@sha256:7a2f1476772636dc85de4df613a6a5dd460e58a3772974d8a067fc509a5449fd,3433
- extensible-0.9@sha256:a93b7e55ccf0407915a2a60944b73577c50377f75de2c28d5a3acac96d231fcd,3344
- incremental-0.3.1@sha256:9c697bae4f7e5ceb144bde13e03ca2f36b4bc2d0c92bbc02e0a604231ee279c2,1153
- membership-0.0.1@sha256:6c4d4ab6e3fb3253c6c670e8a63f74454dc91be50b9f292d0b1355792190aee5,999

0 comments on commit 7bac6a8

Please sign in to comment.