-
Notifications
You must be signed in to change notification settings - Fork 64
/
flake.nix
131 lines (120 loc) · 4.37 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
description = "plutarch";
nixConfig = {
allow-import-from-derivation = "true";
bash-prompt = "\\[\\e[0m\\][\\[\\e[0;2m\\]nix \\[\\e[0;1m\\]plutarch \\[\\e[0;93m\\]\\w\\[\\e[0m\\]]\\[\\e[0m\\]$ \\[\\e[0m\\]";
cores = "1";
max-jobs = "auto";
auto-optimise-store = "true";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-nix.url = "github:input-output-hk/haskell.nix";
iohk-nix.url = "github:input-output-hk/iohk-nix";
iohk-nix.inputs.nixpkgs.follows = "haskell-nix/nixpkgs";
CHaP.url = "github:input-output-hk/cardano-haskell-packages?ref=repo";
CHaP.flake = false;
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
emanote.url = "github:srid/emanote";
};
outputs = inputs@{ flake-parts, nixpkgs, haskell-nix, iohk-nix, CHaP, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
./nix/pre-commit.nix
./nix/hercules-ci.nix
inputs.emanote.flakeModule
];
debug = true;
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ];
hercules-ci.github-pages.branch = "staging";
perSystem = { config, system, lib, self', ... }:
let
pkgs =
import haskell-nix.inputs.nixpkgs {
inherit system;
overlays = [
haskell-nix.overlay
iohk-nix.overlays.crypto
iohk-nix.overlays.haskell-nix-crypto
];
inherit (haskell-nix) config;
};
project = pkgs.haskell-nix.cabalProject' {
src = ./.;
compiler-nix-name = "ghc964";
# NOTE(bladyjoker): Follow https://github.com/input-output-hk/plutus/blob/master/cabal.project
index-state = "2024-01-16T11:00:00Z";
inputMap = {
"https://input-output-hk.github.io/cardano-haskell-packages" = CHaP;
};
shell = {
withHoogle = true;
withHaddock = true;
exactDeps = false;
# TODO(peter-mlabs): Use `apply-refact` for repo wide refactoring `find -name '*.hs' -not -path './dist-*/*' -exec hlint -j --refactor --refactor-options="--inplace" {} +``
shellHook = config.pre-commit.installationScript;
tools = {
cabal = { };
haskell-language-server = { };
hlint = { };
cabal-fmt = { };
fourmolu = { };
hspec-discover = { };
markdown-unlit = { };
};
};
};
flake = project.flake { };
in
{
inherit (flake) devShells;
emanote = {
sites.plutarch-docs = {
layers = [
{
path = ./plutarch-docs;
pathString = "./plutarch-docs";
}
];
baseUrl = "/plutarch-plutus/";
};
};
hercules-ci.github-pages.settings.contents = self'.packages.combined-docs;
packages = flake.packages // {
haddock = (import ./nix/combine-haddock.nix) { inherit pkgs lib; } {
cabalProject = project;
targetPackages = [
"plutarch"
"plutus-core"
"plutus-tx"
"plutus-ledger-api"
];
prologue = ''
= Plutarch Documentation
Documentation of Plutarch /and/ Documentation of Plutus libraries.
'';
};
combined-docs = pkgs.runCommand "combined-docs"
{ } ''
mkdir -p $out/haddock
cp ${self'.packages.haddock}/share/doc/* $out/haddock -r
cp ${self'.packages.plutarch-docs}/* $out -r
'';
};
checks = flake.checks // {
plutarch-test = pkgs.stdenv.mkDerivation
{
name = "plutarch-test";
src = ./plutarch-test;
nativeBuildInputs = [ flake.packages."plutarch-test:exe:plutarch-test" ];
buildPhase = ''
plutarch-test
touch $out
'';
};
};
};
};
}