forked from anmonteiro/piaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
36 lines (32 loc) · 960 Bytes
/
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
{ packages, pkgs, release-mode ? false }:
let
inherit (pkgs) lib callPackage;
piafPkgs = packages.native;
piafDrvs = lib.filterAttrs (_: value: lib.isDerivation value) piafPkgs;
filterDrvs = inputs:
lib.filter
(drv:
# we wanna filter our own packages so we don't build them when entering
# the shell. They always have `pname`
!(lib.hasAttr "pname" drv) ||
drv.pname == null ||
!(lib.any (name: name == drv.pname || name == drv.name) (lib.attrNames piafDrvs)))
inputs;
in
with pkgs;
(mkShell {
OCAMLRUNPARAM = "b";
inputsFrom = lib.attrValues piafDrvs;
buildInputs =
(if release-mode then [
cacert
curl
ocamlPackages.dune-release
git
opam
] else [ ]) ++
(with ocamlPackages; [ ocaml-lsp merlin ocamlformat utop ]);
}).overrideAttrs (o: {
propagatedBuildInputs = filterDrvs o.propagatedBuildInputs;
buildInputs = filterDrvs o.buildInputs;
})