about summary refs log tree commit diff
path: root/third_party/bazel/rules_nixpkgs/WORKSPACE
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-07-04T10·18+0100
committerVincent Ambo <tazjin@google.com>2019-07-04T10·18+0100
commit64275e446e442c9a0a860969501158ed93058441 (patch)
tree482821738cbc68fb1e7c263bc80a2cea4a946a66 /third_party/bazel/rules_nixpkgs/WORKSPACE
parentf723b8b878a3c4a4687b9e337a875500bebb39b1 (diff)
feat(third_party/bazel): Check in rules_nixpkgs from Tweag r/18
Diffstat (limited to 'third_party/bazel/rules_nixpkgs/WORKSPACE')
-rw-r--r--third_party/bazel/rules_nixpkgs/WORKSPACE99
1 files changed, 99 insertions, 0 deletions
diff --git a/third_party/bazel/rules_nixpkgs/WORKSPACE b/third_party/bazel/rules_nixpkgs/WORKSPACE
new file mode 100644
index 000000000000..02db25031108
--- /dev/null
+++ b/third_party/bazel/rules_nixpkgs/WORKSPACE
@@ -0,0 +1,99 @@
+workspace(name = "io_tweag_rules_nixpkgs")
+
+load(
+    "//nixpkgs:nixpkgs.bzl",
+    "nixpkgs_cc_configure",
+    "nixpkgs_git_repository",
+    "nixpkgs_local_repository",
+    "nixpkgs_package",
+)
+
+# For tests
+
+nixpkgs_git_repository(
+    name = "remote_nixpkgs",
+    remote = "https://github.com/NixOS/nixpkgs",
+    revision = "18.09",
+    sha256 = "6451af4083485e13daa427f745cbf859bc23cb8b70454c017887c006a13bd65e",
+)
+
+nixpkgs_local_repository(
+    name = "nixpkgs",
+    nix_file = "//:nixpkgs.nix",
+)
+
+nixpkgs_package(
+    name = "nixpkgs-git-repository-test",
+    attribute_path = "hello",
+    repositories = {"nixpkgs": "@remote_nixpkgs"},
+)
+
+nixpkgs_package(
+    name = "hello",
+    # Deliberately not repository, to test whether repositories works.
+    repositories = {"nixpkgs": "@nixpkgs"},
+)
+
+nixpkgs_package(
+    name = "expr-test",
+    nix_file_content = "let pkgs = import <nixpkgs> {}; in pkgs.hello",
+    # Deliberately not @nixpkgs, to test whether explict file works.
+    repositories = {"nixpkgs": "//:nixpkgs.nix"},
+)
+
+nixpkgs_package(
+    name = "attribute-test",
+    attribute_path = "hello",
+    repository = "@nixpkgs",
+)
+
+nixpkgs_package(
+    name = "expr-attribute-test",
+    attribute_path = "hello",
+    nix_file_content = "import <nixpkgs> {}",
+    repository = "@nixpkgs",
+)
+
+nixpkgs_package(
+    name = "nix-file-test",
+    attribute_path = "hello",
+    nix_file = "//tests:nixpkgs.nix",
+    repository = "@nixpkgs",
+)
+
+nixpkgs_package(
+    name = "nix-file-deps-test",
+    nix_file = "//tests:hello.nix",
+    nix_file_deps = ["//tests:pkgname.nix"],
+    repository = "@nixpkgs",
+)
+
+nixpkgs_package(
+    name = "output-filegroup-test",
+    nix_file = "//tests:output.nix",
+    repository = "@nixpkgs",
+)
+
+nixpkgs_package(
+    name = "extra-args-test",
+    nix_file_content = """
+{ packagePath }: (import <nixpkgs> {}).${packagePath}
+    """,
+    repository = "@nixpkgs",
+    nixopts = ["--argstr", "packagePath", "hello"],
+)
+
+nixpkgs_package(
+    name = "output-filegroup-manual-test",
+    build_file_content = """
+package(default_visibility = [ "//visibility:public" ])
+filegroup(
+    name = "manual-filegroup",
+    srcs = glob(["hi-i-exist", "hi-i-exist-too", "bin/*"]),
+)
+""",
+    nix_file = "//tests:output.nix",
+    repository = "@nixpkgs",
+)
+
+nixpkgs_cc_configure(repository = "@remote_nixpkgs")