-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
136 lines (119 loc) · 3.37 KB
/
WORKSPACE
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
workspace(name = "multi-pkg-example")
load(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_archive",
)
http_archive(
name = "bazel_skylib",
sha256 = "c6966ec828da198c5d9adbaa94c05e3a1c7f21bd012a0b29ba8ddbccb2c93b0d",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.1.1/bazel-skylib-1.1.1.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
RULES_CC_COMMIT = "68cb652a71e7e7e2858c50593e5a9e3b94e5b9a9"
http_archive(
name = "rules_cc",
sha256 = "070e6220f6e695bb2e0d2f11ec8de137661d3700178cff13170c5aebed0b4f08",
strip_prefix = "rules_cc-%s" % RULES_CC_COMMIT,
urls = [
"https://github.com/bazelbuild/rules_cc/archive/%s.tar.gz" % RULES_CC_COMMIT,
],
)
RULES_TWEAG_COMMIT = "a388ab60dea07c3fc182453e89ff1a67c9d3eba6"
http_archive(
name = "io_tweag_rules_nixpkgs",
sha256 = "6bedf80d6cb82d3f1876e27f2ff9a2cc814d65f924deba14b49698bb1fb2a7f7",
strip_prefix = "rules_nixpkgs-%s" % RULES_TWEAG_COMMIT,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % RULES_TWEAG_COMMIT],
)
load(
"@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl",
"rules_nixpkgs_dependencies",
)
rules_nixpkgs_dependencies()
load(
"@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl",
"nixpkgs_cc_configure",
"nixpkgs_local_repository",
)
load("//rules:nixpkgs.bzl", "nixpkgs_package")
nixpkgs_local_repository(
name = "host_nixpkgs",
nix_file = "//nix:nixpkgs.nix",
nix_file_deps = [
"//:flake.lock",
"//nix:bazel.nix",
],
)
NIX_REPOS = {
"nixpkgs": "@host_nixpkgs",
}
NIX_SYSTEMS = {
"aarch64-linux": {
"suffix": "-aarch64-linux",
"config": "@multi-pkg-example//config:aarch64-linux",
"extra_nix_opts": [
"--arg",
"crossSystem",
"{ config = \"aarch64-unknown-linux-gnu\";}",
],
},
"x86_64-linux": {
"suffix": "-x86_64-linux",
"config": "@multi-pkg-example//config:x86_64-linux",
"extra_nix_opts": [],
},
}
nixpkgs_cc_configure(
name = "toolchain-linux-x86_64",
exec_constraints = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
repositories = NIX_REPOS,
target_constraints = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
)
nixpkgs_cc_configure(
name = "toolchain-linux-aarch64",
exec_constraints = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
nix_file = "//nix/toolchains:linux_aarch64.nix",
repositories = NIX_REPOS,
target_constraints = [
"@platforms//cpu:aarch64",
"@platforms//os:linux",
],
)
nixpkgs_package(
name = "openssl",
attribute_path = "openssl",
build_file_content = """
load("@rules_cc//cc:defs.bzl", "cc_library")
cc_library(
name = "openssl",
srcs = glob(["lib/*"]),
hdrs = glob(["include/openssl/**/*.h"]),
includes = ["include"],
visibility=["//visibility:public"]
)
""",
nix_file = "//nix:bazel.nix",
nix_file_deps = [
"//:flake.lock",
"//nix:bazel.nix",
"//nix:nixpkgs.nix",
],
repositories = NIX_REPOS,
systems = NIX_SYSTEMS,
targets = [
"openssl",
],
)