-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathflake.nix
92 lines (87 loc) · 2.71 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
{
description = "Kadena's Pact smart contract language";
inputs = {
hackage = {
url = "github:input-output-hk/hackage.nix";
flake = false;
};
hs-nix-infra = {
url = "github:kadena-io/hs-nix-infra";
inputs.hackage.follows = "hackage";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, hs-nix-infra, flake-utils, ... }:
flake-utils.lib.eachSystem
[ "x86_64-linux" "x86_64-darwin"
"aarch64-linux" "aarch64-darwin" ] (system:
let
inherit (hs-nix-infra) nixpkgs haskellNix;
pkgs = import nixpkgs {
inherit system overlays;
inherit (haskellNix) config;
};
project = pkgs.pact;
flake = project.flake {
# crossPlatforms = p: [ p.ghcjs ];
};
overlays = [ haskellNix.overlay
(final: prev: {
pact =
final.haskell-nix.project' {
src = ./.;
compiler-nix-name = "ghc964";
shell.tools = {
cabal = {};
haskell-language-server = {};
# hlint = {};
};
shell.buildInputs = with pkgs; [
zlib
z3_4_11
pkg-config
(python3.withPackages (ps: [ps.sphinx ps.sphinx_rtd_theme]))
pandoc perl
];
# shell.crossPlatforms = p: [ p.ghcjs ];
};
})
];
# This package depends on other packages at buildtime, but its output does not
# depend on them. This way, we don't have to download the entire closure to verify
# that those packages build.
mkCheck = name: package: pkgs.runCommand ("check-"+name) {} ''
echo ${name}: ${package}
echo works > $out
'';
in rec {
packages.default = flake.packages."pact:exe:pact";
packages.recursive = with hs-nix-infra.lib.recursive system;
wrapRecursiveWithMeta "pact" "${wrapFlake self}.default";
packages.docs = pkgs.stdenv.mkDerivation {
name = "pact-docs";
src = ./docs;
buildInputs = [
(pkgs.python3.withPackages (ps: [ps.sphinx ps.sphinx_rtd_theme]))
pkgs.pandoc
pkgs.perl
];
buildPhase = ''
source ./work.sh
'';
installPhase = ''
mkdir $out
cp -r _build/* $out
'';
};
inherit (flake) devShell;
packages.check = pkgs.runCommand "check" {} ''
echo ${mkCheck "pact" packages.default}
echo ${mkCheck "devShell" devShell}
echo works > $out
'';
# Other flake outputs provided by haskellNix can be accessed through
# this project output
inherit project;
});
}