forked from mlabs-haskell/apropos-tx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
100 lines (89 loc) · 4.22 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
{
description = "apropos-tx";
inputs = {
haskell-nix.url = "github:input-output-hk/haskell.nix";
nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
haskell-nix.inputs.nixpkgs.follows = "haskell-nix/nixpkgs-2105";
plutus.url = "github:input-output-hk/plutus"; # used for libsodium-vrf
flake-compat-ci.url = "github:hercules-ci/flake-compat-ci";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, haskell-nix, plutus, flake-compat, flake-compat-ci }:
let
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
perSystem = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = system: import nixpkgs { inherit system; overlays = [ haskell-nix.overlay ]; inherit (haskell-nix) config; };
projectFor = system:
let
deferPluginErrors = true;
pkgs = nixpkgsFor system;
fakeSrc = pkgs.runCommand "real-source" {} ''
cp -rT ${self} $out
chmod u+w $out/cabal.project
cat $out/cabal-haskell.nix.project >> $out/cabal.project
'';
in
(nixpkgsFor system).haskell-nix.cabalProject' {
src = fakeSrc.outPath;
compiler-nix-name = "ghc8107";
cabalProjectFileName = "cabal.project";
modules = [{
packages = {
marlowe.flags.defer-plugin-errors = deferPluginErrors;
plutus-use-cases.flags.defer-plugin-errors = deferPluginErrors;
plutus-ledger.flags.defer-plugin-errors = deferPluginErrors;
plutus-contract.flags.defer-plugin-errors = deferPluginErrors;
cardano-crypto-praos.components.library.pkgconfig =
nixpkgs.lib.mkForce [ [ (import plutus { inherit system; }).pkgs.libsodium-vrf ] ];
cardano-crypto-class.components.library.pkgconfig =
nixpkgs.lib.mkForce [ [ (import plutus { inherit system; }).pkgs.libsodium-vrf ] ];
};
}];
shell = {
withHoogle = true;
exactDeps = true;
# We use the ones from Nixpkgs, since they are cached reliably.
# Eventually we will probably want to build these with haskell.nix.
nativeBuildInputs = [ pkgs.cabal-install pkgs.hlint pkgs.haskellPackages.fourmolu ];
additional = ps: [
ps.plutarch
];
};
sha256map = {
"https://github.com/Plutonomicon/plutarch"."8d333bd622082bf83e570a9d26c2f62db580b139"
= "sha256-h1aAwaDZOmJNIeR4uCsHJfU+KJTSMsPkPSC0dXp4v70=";
"https://github.com/input-output-hk/plutus.git"."6d8d25d1e84b2a4278da1036aab23da4161b8df8"
= "o8m86TkI1dTo74YbE9CPPNrBfSDSrf//DMq+v2+woEY=";
"https://github.com/Quid2/flat.git"."ee59880f47ab835dbd73bea0847dab7869fc20d8"
= "lRFND+ZnZvAph6ZYkr9wl9VAx41pb3uSFP8Wc7idP9M=";
"https://github.com/input-output-hk/cardano-crypto.git"."07397f0e50da97eaa0575d93bee7ac4b2b2576ec"
= "oxIOVlgm07FAEmgGRF1C2me9TXqVxQulEOcJ22zpTRs=";
"https://github.com/input-output-hk/cardano-base"."78b3928391b558fb1750228f63301ec371f13528"
= "pBUTTcenaSLMovHKGsaddJ7Jh3okRTrtu5W7Rdu6RM4=";
"https://github.com/input-output-hk/cardano-prelude"."fd773f7a58412131512b9f694ab95653ac430852"
= "BtbT5UxOAADvQD4qTPNrGfnjQNgbYNO4EAJwH2ZsTQo=";
};
};
in
{
ciNix = flake-compat-ci.lib.recurseIntoFlakeWith {
flake = self;
systems = [ "x86_64-linux" ];
};
project = perSystem projectFor;
flake = perSystem (system: (projectFor system).flake {});
# this could be done automatically, but would reduce readability
packages = perSystem (system: self.flake.${system}.packages);
checks = perSystem (system: self.flake.${system}.checks);
check = perSystem (system:
(nixpkgsFor system).runCommand "combined-test" {
nativeBuildInputs = builtins.attrValues self.checks.${system};
} "touch $out"
);
apps = perSystem (system: self.flake.${system}.apps);
devShell = perSystem (system: self.flake.${system}.devShell);
};
}