-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
64 lines (58 loc) · 1.96 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
{
description = "OpenID Connect implementation for OCaml";
nixConfig = {
extra-substituters = "https://ocaml.nix-cache.com";
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=";
};
inputs = {
nixpkgs.url = "github:nix-ocaml/nix-overlays";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
};
outputs = { self, nixpkgs, nix-filter, flake-utils }:
{
overlays.default = import ./nix/overlays.nix { inherit nix-filter; };
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
inherit (pkgs) lib;
oidcPkgs = pkgs.recurseIntoAttrs (import ./nix { inherit pkgs nix-filter; doCheck = true; }).native;
oidcDrvs = lib.filterAttrs (_: value: lib.isDerivation value) oidcPkgs;
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 oidcDrvs)))
inputs;
devShells = {
default = (pkgs.mkShell {
inputsFrom = lib.attrValues oidcDrvs;
buildInputs = with pkgs; with ocamlPackages; [
ocaml-lsp
ocamlformat
odoc
reenv
dune-release
cacert
curl
which
];
}).overrideAttrs (o: {
propagatedBuildInputs = filterDrvs o.propagatedBuildInputs;
buildInputs = filterDrvs o.buildInputs;
checkInputs = filterDrvs o.checkInputs;
});
};
in
{
inherit devShells;
packages = {
oidc = oidcPkgs.oidc;
};
}
);
}