-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
154 lines (150 loc) · 4.67 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{
description="Coq plugin to automate commutative diagrams";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
rust = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, rust }: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ rust.overlays.default ];
};
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;
coq = (pkgs.coq.override {
version = "8.17";
coq-version = "8.17";
customOCamlPackages = ocamlPackages;
}).overrideAttrs (final: prev: {
patches = (prev.patches or [ ]) ++ [ ./fix-coqmakefile.patch ];
});
coqPackages = pkgs.mkCoqPackages coq;
unimath = coqPackages.callPackage ./unimath.nix {};
pkg-coq-plugin = ocamlPackages.callPackage ./coq/plugin.nix {
inherit coq;
};
pkg-coq-unimath = coqPackages.callPackage ./coq/unimath.nix {
inherit unimath;
coq-commutative-diagrams-plugin = pkg-coq-plugin;
};
pkg-engine = pkgs.callPackage ./engine {
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rust-bin.stable.latest.minimal;
rustc = pkgs.rust-bin.stable.latest.minimal;
};
};
shell-coq = pkgs.mkShell {
# Build tools
nativeBuildInputs = builtins.attrValues {
inherit (ocamlPackages)
ocaml
findlib
dune_3
# ocaml-lsp
merlin
;
coqide = coqPackages.coqide;
};
# Dependencies
inputsFrom = [ pkg-coq-plugin pkg-coq-unimath ];
};
shell-engine = pkgs.mkShell {
nativeBuildInputs = [
(pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-analyzer" "rust-src" ];
})
pkgs.fontconfig.dev
pkgs.freetype.dev
pkgs.alsa-lib.dev
pkgs.systemd.dev
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.vulkan-tools
pkgs.vulkan-headers
pkgs.vulkan-loader
pkgs.vulkan-validation-layers
];
};
shell = pkgs.mkShell {
inputsFrom = [ shell-coq shell-engine ];
nativeBuildInputs = builtins.attrValues {
inherit (pkgs)
msgpack-tools
;
};
PKG_CONFIG_PATH = pkgs.lib.concatStringsSep ":" [
"${pkgs.fontconfig.dev}/lib/pkgconfig"
"${pkgs.freetype.dev}/lib/pkgconfig"
"${pkgs.alsa-lib.dev}/lib/pkgconfig"
"${pkgs.systemd.dev}/lib/pkgconfig"
];
LD_LIBRARY_PATH = pkgs.lib.concatStringsSep ":" [
"${pkgs.xorg.libX11}/lib"
"${pkgs.xorg.libXcursor}/lib"
"${pkgs.xorg.libXrandr}/lib"
"${pkgs.xorg.libXi}/lib"
"${pkgs.vulkan-tools}/lib"
"${pkgs.vulkan-headers}/lib"
"${pkgs.vulkan-loader}/lib"
"${pkgs.vulkan-validation-layers}/lib"
];
};
shell-user = include-unimath: let
ocaml-version = ocamlPackages.ocaml.version;
mkOcamlPath =
pkgs.lib.concatMapStringsSep
":"
(pkg: "${pkg}/lib/ocaml/${ocaml-version}/site-lib");
in pkgs.mkShell {
nativeBuildInputs = [
self.packages.x86_64-linux.commutative-diagrams-coq
coq
coqPackages.coqide
ocamlPackages.zarith
]
++ (if include-unimath
then [ unimath ]
else []);
"COMDIAG_ENGINE" = "${self.packages.x86_64-linux.commutative-diagrams-engine}/bin/commutative-diagrams-engine";
"OCAMLPATH" = mkOcamlPath ([
self.packages.x86_64-linux.commutative-diagrams-coq
coq
ocamlPackages.zarith
]
++ (if include-unimath
then [ self.packages.x86_64-linux.commutative-diagrams-coq-unimath ]
else [ ]));
"LD_LIBRARY_PATH" = pkgs.lib.concatStringsSep ":" [
"${pkgs.xorg.libX11}/lib"
"${pkgs.xorg.libXcursor}/lib"
"${pkgs.xorg.libXrandr}/lib"
"${pkgs.xorg.libXi}/lib"
"${pkgs.vulkan-tools}/lib"
"${pkgs.vulkan-headers}/lib"
"${pkgs.vulkan-loader}/lib"
"${pkgs.vulkan-validation-layers}/lib"
];
"COMDIAG_LOADER_NAME" = if include-unimath then "CommutativeDiagrams.Loader" else "UniMath.CategoryTheory.CommutativeDiagrams";
};
in {
devShells.x86_64-linux = {
coq-plugin = shell-coq;
engine = shell-engine;
default = shell;
user = shell-user true;
unimath-user = shell-user false;
};
packages.x86_64-linux = {
commutative-diagrams-coq = pkg-coq-plugin;
commutative-diagrams-coq-unimath = pkg-coq-unimath;
commutative-diagrams-engine = pkg-engine;
inherit unimath;
default = pkg-engine;
};
};
}