forked from runtimeverification/llvm-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
146 lines (133 loc) · 5.03 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
{
description = "K Kore Language LLVM Backend";
inputs = {
utils.url = "github:numtide/flake-utils";
rv-utils.url = "github:runtimeverification/rv-nix-tools";
nixpkgs.follows = "rv-utils/nixpkgs";
fmt-src.url =
"github:fmtlib/fmt/9.1.0";
fmt-src.flake = false;
immer-src.url =
"github:runtimeverification/immer/4b0914f0b2acb33befe0ba4cd3a7954f2687e9bb";
immer-src.flake = false;
rapidjson-src.url =
"github:Tencent/rapidjson/f54b0e47a08782a6131cc3d60f94d038fa6e0a51";
rapidjson-src.flake = false;
pybind11-src.url =
"github:pybind/pybind11/0ba639d6177659c5dc2955ac06ad7b5b0d22e05c";
pybind11-src.flake = false;
# needed by nix/flake-compat-k-unwrapped.nix
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, utils, fmt-src, immer-src, rapidjson-src, pybind11-src, ... }:
let
inherit (nixpkgs) lib;
# put required packages into local overlay
# if you have additional overlays, you may add them here
localOverlay = import ./nix/overlay.nix;
depsOverlay = (final: prev: {
inherit fmt-src immer-src rapidjson-src pybind11-src;
llvm-backend-src = prev.stdenv.mkDerivation {
name = "llvm-backend-src";
src = prev.lib.cleanSource (prev.nix-gitignore.gitignoreSourcePure [
"/nix"
"*.nix"
"*.nix.sh"
"/.github"
"flake.lock"
./.gitignore
] ./.);
dontBuild = true;
installPhase = ''
mkdir $out
cp -rv $src/* $out
chmod -R u+w $out
mkdir -p $out/deps/fmt
mkdir -p $out/deps/immer
mkdir -p $out/deps/rapidjson
mkdir -p $out/deps/pybind11
cp -rv ${final.fmt-src}/* $out/deps/fmt
cp -rv ${final.immer-src}/* $out/deps/immer
cp -rv ${final.rapidjson-src}/* $out/deps/rapidjson
cp -rv ${final.pybind11-src}/* $out/deps/pybind11
'';
};
llvm-backend-matching-src = prev.lib.cleanSource
(prev.nix-gitignore.gitignoreSourcePure [
"/nix"
"*.nix"
"*.nix.sh"
"/.github"
"flake.lock"
./.gitignore
] ./matching);
});
maven-overlay = (final: prev: {
maven = prev.callPackage ./nix/maven.nix { };
});
llvm-backend-overlay =
nixpkgs.lib.composeManyExtensions [ depsOverlay localOverlay ];
pkgsForSystem = system: llvm-version: llvm-backend-build-type:
import nixpkgs {
overlays = [
(final: prev: {
inherit llvm-version;
inherit llvm-backend-build-type;
maven = prev.maven // { inherit (prev) jdk; };
})
maven-overlay
llvm-backend-overlay
];
inherit system;
};
in utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system:
let
listToChecks = checks:
builtins.listToAttrs (lib.imap0 (i: v: { name = "check_${toString i}"; value = v; }) checks);
matrix = builtins.listToAttrs (lib.forEach (lib.cartesianProductOfSets {
llvm-version = [15 16 17 18];
build-type = ["Debug" "Release" "RelWithDebInfo" "FastBuild" "GcStats"];
}) (
args:
let pkgs = pkgsForSystem system args.llvm-version args.build-type; in
{
name = "llvm-backend-${toString args.llvm-version}-${args.build-type}";
value = {
inherit (pkgs) llvm-backend llvm-backend-matching llvm-kompile-testing integration-tests integration-test-shell;
};
}
));
in with matrix; {
packages = utils.lib.flattenTree {
inherit (llvm-backend-18-FastBuild) llvm-backend llvm-backend-matching llvm-kompile-testing;
default = llvm-backend-18-FastBuild.llvm-backend;
llvm-backend-release = llvm-backend-18-Release.llvm-backend;
integration-test-shell-15 = llvm-backend-15-Debug.integration-test-shell;
integration-test-shell-16 = llvm-backend-16-Debug.integration-test-shell;
integration-test-shell-17 = llvm-backend-17-Debug.integration-test-shell;
integration-test-shell-18 = llvm-backend-18-Debug.integration-test-shell;
};
checks = listToChecks [
llvm-backend-18-Debug.llvm-backend
llvm-backend-18-Release.llvm-backend
llvm-backend-18-RelWithDebInfo.llvm-backend
llvm-backend-18-GcStats.llvm-backend
llvm-backend-15-FastBuild.integration-tests
llvm-backend-16-FastBuild.integration-tests
llvm-backend-17-FastBuild.integration-tests
llvm-backend-18-FastBuild.integration-tests
];
}) // {
# non-system suffixed items should go here
overlays.default = llvm-backend-overlay;
overlays.maven = maven-overlay;
};
}