-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathflake.nix
136 lines (122 loc) · 4.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
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
132
133
134
135
136
{
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:intersectmbo/cardano-haskell-packages?ref=repo";
flake = false;
};
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
herbage.url = "github:seungheonoh/herbage";
};
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
];
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
inputs.herbage.overlays.default
];
inherit (haskell-nix) config;
};
herbage = inputs.herbage.lib { inherit pkgs; };
project = pkgs.haskell-nix.cabalProject' {
src = ./.;
compiler-nix-name = "ghc966";
# NOTE(bladyjoker): Follow https://github.com/input-output-hk/plutus/blob/master/cabal.project
index-state = "2024-10-09T22:38:57Z";
inputMap = {
"https://chap.intersectmbo.org/" = 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;
nativeBuildInputs = with pkgs; [
mdbook
hackage-repo-tool
];
tools = {
cabal = { };
haskell-language-server = { };
hlint = { };
cabal-fmt = { };
fourmolu = { };
hspec-discover = { };
markdown-unlit = { };
};
};
};
flake = project.flake { };
in
{
inherit (flake) devShells;
hercules-ci.github-pages.settings.contents = self'.packages.combined-docs;
packages = flake.packages // {
plutarch-docs = pkgs.stdenv.mkDerivation {
name = "pluatrch-docs";
src = ./plutarch-docs;
buildInputs = with pkgs; [ mdbook ];
buildPhase = ''
mdbook build . -d $out
'';
};
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.
'';
};
# We do have keys for signing hackage set exposed in the repository. Once I figure out how to
# store secrets in Hercules CI, I'd have to fix this.
# However, since deployment of hackage sets are fully automatized using Hercules CI,
# This should remain secure as long as Plutonomicon/Plutarch repository is secure.
hackage =
herbage.genHackage
./keys
(import ./nix/hackage.nix { inherit pkgs; });
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
cp ${self'.packages.hackage}/* $out -r
'';
};
inherit (flake) checks;
};
};
}