-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
139 lines (127 loc) · 5.08 KB
/
flake.nix
File metadata and controls
139 lines (127 loc) · 5.08 KB
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
137
138
139
{
description = "majority-multisign";
inputs.haskell-nix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskell-nix/nixpkgs-unstable";
inputs.haskell-nix.inputs.nixpkgs.follows = "haskell-nix/nixpkgs-2105";
inputs.plutus.url = "github:input-output-hk/plutus"; # used for libsodium-vrf
outputs = { self, nixpkgs, haskell-nix, plutus }:
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
'';
sources = import ./nix/sources.nix { };
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 ] ];
cardano-wallet-core.components.library.build-tools = [
(import plutus {
inherit system;
}).pkgs.buildPackages.buildPackages.gitMinimal
];
cardano-config.components.library.build-tools = [
(import plutus {
inherit system;
}).pkgs.buildPackages.buildPackages.gitMinimal
];
};
}];
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.tasty-plutus
ps.quickcheck-plutus-instances
ps.plutus-collection
ps.plutus-laws
ps.plutus-golden
ps.base-deriving-via
ps.cardano-addresses
ps.cardano-addresses-cli
ps.cardano-binary
ps.cardano-crypto
ps.cardano-crypto-class
ps.cardano-crypto-praos
ps.cardano-crypto-wrapper
ps.cardano-ledger-alonzo
ps.cardano-ledger-byron
ps.cardano-ledger-core
ps.cardano-ledger-pretty
ps.cardano-ledger-shelley
ps.cardano-ledger-shelley-ma
ps.cardano-prelude
ps.cardano-slotting
ps.flat
ps.freer-extras
ps.goblins
ps.measures
ps.orphans-deriving-via
ps.playground-common
ps.plutus-contract
ps.plutus-chain-index
ps.plutus-core
ps.plutus-ledger
ps.plutus-ledger-api
ps.plutus-pab
ps.plutus-playground-server
ps.plutus-tx
ps.plutus-tx-plugin
ps.plutus-use-cases
ps.prettyprinter-configurable
ps.quickcheck-dynamic
ps.Win32-network
ps.word-array
];
};
sha256map = pkgs.lib.foldr (data: tab:
with data;
tab // {
"https://github.com/${owner}/${repo}"."${rev}" = sha256;
"https://github.com/${owner}/${repo}.git"."${rev}" = sha256;
}) { } (pkgs.lib.attrValues sources);
};
in {
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);
};
}