-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Expand file tree
/
Copy pathflake.nix
More file actions
110 lines (100 loc) · 3.2 KB
/
Copy pathflake.nix
File metadata and controls
110 lines (100 loc) · 3.2 KB
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
{
description = "StarRocks development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs =
{ self, nixpkgs }:
let
lib = nixpkgs.lib;
revision = self.shortRev or self.dirtyShortRev or "unknown";
version = "main-${revision}";
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems =
f:
lib.genAttrs systems (
system:
f (
import nixpkgs {
inherit system;
}
)
);
mkEnv =
pkgs:
import ./nix/dev-env.nix {
inherit pkgs version;
src = self.outPath;
commitHash = revision;
};
forAllSystemsWithEnv =
f:
forAllSystems (
pkgs:
let
env = mkEnv pkgs;
in
f pkgs env
);
in
{
packages = forAllSystemsWithEnv (
pkgs: env: {
default = env.starrocks;
starrocks = env.starrocks;
starrocks-build-env = env.buildWrapper;
starrocks-maven-deps = env.mavenDeps;
starrocks-thirdparty = env.starrocksThirdparty;
starrocks-thirdparty-foundation = env.starrocksThirdpartyFoundation;
starrocks-thirdparty-rpc = env.starrocksThirdpartyRpc;
starrocks-thirdparty-formats = env.starrocksThirdpartyFormats;
starrocks-thirdparty-leaf = env.starrocksThirdpartyLeaf;
}
);
devShells = forAllSystemsWithEnv (
pkgs: env: {
default = env.devShell;
be = env.beDevShell;
}
);
checks = forAllSystemsWithEnv (
pkgs: env: {
starrocks-nix-env =
pkgs.runCommand "starrocks-nix-env-check"
{
nativeBuildInputs = env.checkInputs;
buildInputs = env.checkLinkInputs;
strictDeps = true;
src = self;
}
''
cp -R "$src" source
chmod -R +w source
cd source
bash -n build-support/build_helpers.sh
. build-support/build_helpers.sh
cp nix/thirdparty-archives.nix thirdparty-archives.generated-check
python3 nix/generate-thirdparty-archives.py
diff -u thirdparty-archives.generated-check nix/thirdparty-archives.nix
OSTYPE=darwin
getopt_path="$(starrocks_resolve_getopt_bin)"
test -x "$getopt_path"
starrocks-build-env --print > "$out"
${lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
cxx="$(grep '^CXX=' "$out" | cut -d= -f2-)"
export LIBRARY_PATH="$(grep '^LIBRARY_PATH=' "$out" | cut -d= -f2-)"
export NIX_LDFLAGS="$(grep '^NIX_LDFLAGS=' "$out" | cut -d= -f2-)"
printf 'int main() { return 0; }\n' > libiberty-check.cc
"$cxx" libiberty-check.cc -liberty -o libiberty-check
./libiberty-check
''}
'';
}
);
formatter = forAllSystems (pkgs: pkgs.nixfmt);
};
}