-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
143 lines (135 loc) · 4.14 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
137
138
139
140
141
142
143
{
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
"https://cache.sc.iog.io"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"cache.sc.iog.io:b4YIcBabCEVKrLQgGW8Fylz4W8IvvfzRc+hy0idqrWU="
];
accept-flake-config = true;
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
purescript-overlay.url = "github:thomashoneyman/purescript-overlay";
purescript-overlay.inputs.nixpkgs.follows = "nixpkgs";
cardano-node.url = "github:input-output-hk/cardano-node/d7abccd4e90c38ff5cd4d6a7839689d888332056";
};
outputs =
{ self
, nixpkgs
, flake-utils
, purescript-overlay
, cardano-node
, pre-commit-hooks
}:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [
purescript-overlay.overlays.default
];
pkgs = import nixpkgs {
inherit system overlays;
};
kupo = pkgs.callPackage ./nix/packages/kupo.nix { };
ogmios = pkgs.callPackage ./nix/packages/ogmios.nix { };
in
rec {
checks = {
pre-commit-check = pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
fourmolu.enable = true;
shellcheck.enable = true;
cabal-fmt.enable = true;
nixpkgs-fmt.enable = true;
purs-tidy.enable = true;
end-of-file-fixer =
{
enable = true;
excludes = [ ".*\\.golden" ];
};
trim-trailing-whitespace =
{
enable = true;
excludes = [ ".*\\.golden" ];
};
};
tools = {
cabal-fmt = pkgs.haskellPackages.cabal-fmt.bin;
fourmolu = pkgs.haskellPackages.fourmolu;
shellcheck = pkgs.shellcheck;
nixpkgs-fmt = pkgs.nixpkgs-fmt;
purs-tidy = pkgs.purs-tidy;
};
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
#
# build tools
#
awscli2
bashInteractive
blst
cabal-install
dhall
esbuild
fd
ghc
git
gnumake
haskell-language-server
haskellPackages.cabal-fmt
haskellPackages.fourmolu
hlint
libsodium
nixpkgs-fmt
nodejs
pkg-config
purescript
purescript-psa
purs-tidy
eslint
secp256k1
zlib
zip
#
# runtime dependencie
#
cardano-node.packages."${system}".cardano-cli
cardano-node.packages."${system}".cardano-node
cardano-node.packages."${system}".cardano-testnet
ogmios
kupo
#
# Rust dependencies for raw-scripts crate
#
cargo
clippy
rust-analyzer
rustfmt
cargo-edit
];
shellHook = ''
# The following settings are required for cardano-testnet to work properly
export CARDANO_CLI=${cardano-node.packages."${system}".cardano-cli}/bin/cardano-cli
export CARDANO_NODE=${cardano-node.packages."${system}".cardano-node}/bin/cardano-node
# LD_LIBRARY_PATH is required for cabal to find libraries
export LD_LIBRARY_PATH="${pkgs.blst}/lib:${pkgs.libsodium}/lib:${pkgs.secp256k1}/lib"
${checks.pre-commit-check.shellHook}
'' + pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
# There is a problem with cardano-testnet exceeding the MAX_PATH length
# so we need to set it to something other than the default long path
export TMPDIR=/private/tmp
'' + pkgs.lib.optionalString pkgs.stdenv.isLinux ''
# Under Linux there is a problem with cardano-testnet failing because
# of hedgehog on startup if locale isn't set to UTF8
export LC_ALL=C.utf8
'';
};
});
}