Skip to content

Commit

Permalink
Test the http repository rule
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann committed Mar 22, 2023
1 parent 2423bd2 commit 41c75af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testing/core/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ local_path_override(
non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps")
use_repo(non_module_deps, "nixpkgs")
use_repo(non_module_deps, "remote_nixpkgs")
use_repo(non_module_deps, "http_nixpkgs")
use_repo(non_module_deps, "nixpkgs_content")
use_repo(non_module_deps, "hello")
use_repo(non_module_deps, "expr-test")
Expand All @@ -26,6 +27,7 @@ use_repo(non_module_deps, "extra-args-test")
use_repo(non_module_deps, "nix-file-test")
use_repo(non_module_deps, "nix-file-deps-test")
use_repo(non_module_deps, "nixpkgs-git-repository-test")
use_repo(non_module_deps, "nixpkgs-http-repository-test")
use_repo(non_module_deps, "nixpkgs-local-repository-test")
use_repo(non_module_deps, "relative-imports")
use_repo(non_module_deps, "output-filegroup-test")
Expand Down
1 change: 1 addition & 0 deletions testing/core/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ expand_location_unit_test_suite()
"nix-file-test",
"nix-file-deps-test",
"nixpkgs-git-repository-test",
"nixpkgs-http-repository-test",
"nixpkgs-local-repository-test",
"relative-imports",
]
Expand Down
14 changes: 14 additions & 0 deletions testing/core/tests/nixpkgs_repositories.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load(
"@rules_nixpkgs_core//:nixpkgs.bzl",
"nixpkgs_git_repository",
"nixpkgs_http_repository",
"nixpkgs_local_repository",
"nixpkgs_package",
)
Expand All @@ -19,6 +20,13 @@ def nixpkgs_repositories():
sha256 = "0f8c25433a6611fa5664797cd049c80faefec91575718794c701f3b033f2db01",
)

nixpkgs_http_repository(
name = "http_nixpkgs",
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/22.05.tar.gz",
strip_prefix = "nixpkgs-22.05",
sha256 = "0f8c25433a6611fa5664797cd049c80faefec91575718794c701f3b033f2db01",
)

# same as @nixpkgs but using the `nix_file_content` parameter
nixpkgs_local_repository(
name = "nixpkgs_content",
Expand Down Expand Up @@ -89,6 +97,12 @@ def nixpkgs_repositories():
repositories = {"nixpkgs": "@remote_nixpkgs"},
)

nixpkgs_package(
name = "nixpkgs-http-repository-test",
attribute_path = "hello",
repositories = {"nixpkgs": "@http_nixpkgs"},
)

nixpkgs_package(
name = "nixpkgs-local-repository-test",
nix_file_content = "with import <nixpkgs> {}; hello",
Expand Down

0 comments on commit 41c75af

Please sign in to comment.