forked from IntersectMBO/cardano-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
87 lines (75 loc) · 2.65 KB
/
shell.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
# This file is used by nix-shell.
# It just takes the shell attribute from default.nix.
{ config ? {}
, customConfig ? {}
, sourcesOverride ? {}
, withHoogle ? true
, pkgs ? import ./nix {
inherit config sourcesOverride;
}
}:
with pkgs;
let
# This provides a development environment that can be used with nix-shell or
# lorri. See https://input-output-hk.github.io/haskell.nix/user-guide/development/
shell = cardanoNodeHaskellPackages.shellFor {
name = "cabal-dev-shell";
# If shellFor local packages selection is wrong,
# then list all local packages then include source-repository-package that cabal complains about:
packages = ps: with ps; [
ps.cardano-node
ps.cardano-config
ps.cardano-cli
];
# These programs will be available inside the nix-shell.
buildInputs = with haskellPackages; [
cabal-install
ghcid
hlint
weeder
nix
niv
pkgconfig
profiteur
profiterole
ghc-prof-flamegraph
sqlite-interactive
tmux
git
];
# Prevents cabal from choosing alternate plans, so that
# *all* dependencies are provided by Nix.
exactDeps = true;
inherit withHoogle;
};
devops = pkgs.stdenv.mkDerivation {
name = "devops-shell";
buildInputs = [
niv
cardanoNodeHaskellPackages.cardano-cli.components.exes.cardano-cli
cardanoNodeHaskellPackages.cardano-node.components.exes.cardano-node
];
shellHook = ''
echo "DevOps Tools" \
| ${figlet}/bin/figlet -f banner -c \
| ${lolcat}/bin/lolcat
source <(cardano-cli --bash-completion-script cardano-cli)
source <(cardano-node --bash-completion-script cardano-node)
${lib.optionalString (__hasAttr "network" customConfig) ''
export CARDANO_NODE_SOCKET_PATH="$PWD/state-node-${customConfig.network}/node.socket"
${lib.optionalString (__hasAttr "utxo" pkgs.commonLib.cardanoLib.environments.${customConfig.network}) ''
# Selfnode and other test clusters have public secret keys that we pull from iohk-nix
echo "To access funds use UTXO_SKEY and UTXO_VKEY environment variables"
export UTXO_SKEY="${pkgs.commonLib.cardanoLib.environments.${customConfig.network}.utxo.signing}"
export UTXO_VKEY="${pkgs.commonLib.cardanoLib.environments.${customConfig.network}.utxo.verification}"
''}
''}
echo "NOTE: you may need to export GITHUB_TOKEN if you hit rate limits with niv"
echo "Commands:
* niv update <package> - update package
* cardano-cli - used for key generation and other operations tasks
"
'';
};
in
shell // { inherit devops; }