forked from IntersectMBO/cardano-ledger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
85 lines (73 loc) · 2.3 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
# This file is used by nix-shell.
{ config ? {}
, sourcesOverride ? {}
, withHoogle ? false
, pkgs ? import ./nix {
inherit config sourcesOverride;
}
}:
with pkgs;
let
ormolu = import pkgs.commonLib.sources.ormolu {};
# For building the sphinx doc
pyEnv =
# TODO: deduplicate with default.nix
let
sphinx-markdown-tables = pkgs.python3Packages.callPackage ./nix/python/sphinx-markdown-tables.nix {};
sphinxemoji = pkgs.python3Packages.callPackage ./nix/python/sphinxemoji.nix {};
in pkgs.python3.withPackages (ps: [ ps.sphinx ps.sphinx_rtd_theme ps.recommonmark sphinx-markdown-tables sphinxemoji ]);
# 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 = cardanoLedgerSpecsHaskellPackages.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: lib.attrValues (haskell-nix.haskellLib.selectProjectPackages ps);
# These programs will be available inside the nix-shell.
buildInputs = with haskellPackages; [
nix-prefetch-git
niv
pkg-config
hlint
ormolu.ormolu
pyEnv
];
tools = {
cabal = "3.4.0.0";
ghcid = "0.8.7";
haskell-language-server="latest";
};
# Prevents cabal from choosing alternate plans, so that
# *all* dependencies are provided by Nix.
exactDeps = false;
inherit withHoogle;
shellHook = ''
DEFAULT_PS1="\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] "
prompt() {
local EXIT="$?"
if [ $EXIT != 0 ]; then
PS1="$DEFAULT_PS1\[\033[1;31m\]($EXIT)\[\033[00m\] "
else
PS1="$DEFAULT_PS1"
fi
}
PROMPT_COMMAND=prompt
'';
};
devops = pkgs.stdenv.mkDerivation {
name = "devops-shell";
buildInputs = [
niv
];
shellHook = ''
echo "DevOps Tools" \
| ${figlet}/bin/figlet -f banner -c \
| ${lolcat}/bin/lolcat
echo "NOTE: you may need to export GITHUB_TOKEN if you hit rate limits with niv"
echo "Commands:
* niv update <package> - update package
"
'';
};
in
shell // { inherit devops; }