Skip to content

Make nix integration more seamless #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.cache
bazel-*
.output-bazelrc
bazel-*
nix/bzl/nix-file-deps.bzl
22 changes: 13 additions & 9 deletions example_project_bzl_4/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ http_archive(
sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241",
)

http_archive(
name = "io_tweag_rules_nixpkgs",
sha256 = "7efb0f82cda5cdaa8e96b687734c5704b91353561d7889e5d84a13b6d30f4cb8",
strip_prefix = "rules_nixpkgs-05a445575de51872f528c537cc7ff3ab11114f21",
urls = ["https://github.com/tweag/rules_nixpkgs/archive/05a445575de51872f528c537cc7ff3ab11114f21.tar.gz"],
local_repository(
name = "distruptor_nix",
path = "../nix",
)

load("@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", "rules_nixpkgs_dependencies")
rules_nixpkgs_dependencies()
load("@distruptor_nix//bzl:deps.bzl", "distruptor_deps")
distruptor_deps()

load("@distruptor_nix//bzl:deps_init.bzl", "deps_init")
deps_init()

load("@distruptor_nix//bzl:defs.bzl", "nix_repositories_init")
nix_repositories_init()

load("//third_party/nix:defs.bzl", "NIX_REPOSITORIES", "nix_repositories")
nix_repositories()
load("@distruptor_nix//bzl:pkgs.bzl", "nix_packages_init")
nix_packages_init()

load("//third_party/cpp_toolchains:defs.bzl", "cpp_toolchains")
cpp_toolchains()
Expand Down
2 changes: 1 addition & 1 deletion example_project_bzl_4/hello_world/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ cc_binary(
"*.cpp"
]),
deps = [
"//third_party/xz"
"@distruptor_nix//bzl/packages:xz"
]
)
2 changes: 1 addition & 1 deletion example_project_bzl_4/readline_example_c/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ cc_binary(
"*.c"
]),
deps = [
"//third_party/readline",
"@distruptor_nix//bzl/packages:readline"
]
)
2 changes: 1 addition & 1 deletion example_project_bzl_4/server_c/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ cc_binary(
"*.c"
]),
deps = [
"//third_party/libuv",
"@distruptor_nix//bzl/packages:libuv"
]
)
1 change: 1 addition & 0 deletions example_project_bzl_4/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ in pkgs.stdenv.mkDerivation {
export TERM=xterm
# readlink as absolute path is needed
echo "startup --output_base $(readlink -f ./bazel-output)" > "$(pwd)"/.output-bazelrc
echo "build --disk_cache=$(readlink -f $(pwd))/bazel-disk-cache" >> "$(pwd)"/.output-bazelrc
'';
TMPDIR = "/tmp";
}
1 change: 1 addition & 0 deletions example_project_bzl_4/third_party/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" This packages contains thrid party dependencies. """
load("@distruptor_nix//bzl:defs.bzl", "nix_package")

exports_files([
"dependencies.bzl"
Expand Down
3 changes: 1 addition & 2 deletions example_project_bzl_4/third_party/cpp_toolchains/defs.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@distruptor_nix//bzl:defs.bzl", "NIX_REPOSITORIES")
load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_cc_configure")
load("//third_party/nix:defs.bzl", "NIX_REPOSITORIES")


def cpp_toolchains():
# Naming convention (after nixpkgs)
Expand Down
13 changes: 0 additions & 13 deletions example_project_bzl_4/third_party/dependencies.bzl
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
load("@//third_party/libuv:defs.bzl", "libuv")
load("@//third_party/ncurses:defs.bzl", "ncurses")
load("@//third_party/readline:defs.bzl", "readline")
load("@//third_party/xorg.libX11:defs.bzl", "libX11")
load("@//third_party/xorg.xorgproto:defs.bzl", "xorgproto")
load("@//third_party/xz:defs.bzl", "xz")

def third_party_deps():
"""Load 3rd party dependencies"""
libuv()
libX11()
ncurses()
readline()
xorgproto()
xz()
15 changes: 0 additions & 15 deletions example_project_bzl_4/third_party/libuv/BUILD.bazel

This file was deleted.

18 changes: 0 additions & 18 deletions example_project_bzl_4/third_party/libuv/BUILD.bazel.tmpl

This file was deleted.

31 changes: 0 additions & 31 deletions example_project_bzl_4/third_party/libuv/defs.bzl

This file was deleted.

21 changes: 0 additions & 21 deletions example_project_bzl_4/third_party/ncurses/BUILD.bazel

This file was deleted.

18 changes: 0 additions & 18 deletions example_project_bzl_4/third_party/ncurses/BUILD.bazel.tmpl

This file was deleted.

25 changes: 0 additions & 25 deletions example_project_bzl_4/third_party/ncurses/common.nix

This file was deleted.

35 changes: 0 additions & 35 deletions example_project_bzl_4/third_party/ncurses/defs.bzl

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions example_project_bzl_4/third_party/nix/BUILD.bazel

This file was deleted.

13 changes: 0 additions & 13 deletions example_project_bzl_4/third_party/nix/defs.bzl

This file was deleted.

22 changes: 0 additions & 22 deletions example_project_bzl_4/third_party/readline/BUILD.bazel

This file was deleted.

21 changes: 0 additions & 21 deletions example_project_bzl_4/third_party/readline/BUILD.bazel.tmpl

This file was deleted.

21 changes: 0 additions & 21 deletions example_project_bzl_4/third_party/readline/common.nix

This file was deleted.

Loading