-
Notifications
You must be signed in to change notification settings - Fork 461
/
shell.nix
88 lines (81 loc) · 2.49 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
88
{ packageSet ? import ./default.nix { rev = "in-nix-shell"; }
}:
with packageSet;
let
# For Sphinx, and ad-hoc usage
pyEnv = pkgs.python3.withPackages (ps: [ packageSet.sphinxcontrib-haddock.sphinxcontrib-domaintools ps.sphinx ps.sphinx_rtd_theme ]);
# Called from Cabal to generate the Haskell source for the metatheory package
agdaWithStdlib = agdaPackages.agda.withPackages [ agdaPackages.standard-library ];
# Configure project pre-commit hooks
pre-commit-check = pkgs.nix-pre-commit-hooks.run {
src = (pkgs.lib.cleanSource ./.);
tools = {
stylish-haskell = dev.packages.stylish-haskell;
nixpkgs-fmt = pkgs.nixpkgs-fmt;
shellcheck = pkgs.shellcheck;
};
hooks = {
stylish-haskell.enable = true;
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
};
};
in
haskell.packages.shellFor {
nativeBuildInputs = [
# From nixpkgs
pkgs.ghcid
pkgs.git
pkgs.cacert
pkgs.niv
pkgs.nodejs
pkgs.shellcheck
pkgs.yarn
pkgs.zlib
pkgs.z3
pkgs.nixpkgs-fmt
# Broken on 20.03, needs a backport
# pkgs.sqlite-analyzer
pkgs.sqlite-interactive
pkgs.stack
pyEnv
agdaWithStdlib
# Deployment tools
pkgs.terraform_0_12
pkgs.awscli
pkgs.aws_shell
pkgs.pass
pkgs.yubikey-manager
# Extra dev packages acquired from elsewhere
dev.packages.cabal-install
dev.packages.hlint
dev.packages.stylish-haskell
dev.packages.haskell-language-server
dev.packages.hie-bios
dev.packages.purty
dev.packages.purs
dev.packages.spago
dev.scripts.fixStylishHaskell
dev.scripts.fixPurty
dev.scripts.updateClientDeps
dev.scripts.updateMetadataSamples
] ++ (pkgs.stdenv.lib.optionals (!pkgs.stdenv.isDarwin) [
# This breaks compilation of R on macOS. The latest version of R
# does compile, so we can remove it when we upgrade to 20.09.
pkgs.rPackages.plotly # for generating R plots locally
pkgs.R
]);
# we have a local passwords store that we use for deployments etc.
PASSWORD_STORE_DIR = toString ./. + "/secrets";
shellHook = ''
${pre-commit-check.shellHook}
''
# Work around https://github.com/NixOS/nix/issues/3345, which makes
# tests etc. run single-threaded in a nix-shell.
# Sets the affinity to cores 0-1000 for $$ (current PID in bash)
# Only necessary for linux - darwin doesn't even expose thread
# affinity APIs!
+ pkgs.lib.optionalString pkgs.stdenv.isLinux ''
${pkgs.utillinux}/bin/taskset -pc 0-1000 $$
'';
}