diff options
Diffstat (limited to 'third_party/bazel/rules_nixpkgs/WORKSPACE')
-rw-r--r-- | third_party/bazel/rules_nixpkgs/WORKSPACE | 99 |
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") |