From 41c75af0aa170378ff2283c89f6200ce4b27f418 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Tue, 21 Mar 2023 17:59:09 +0100 Subject: [PATCH] Test the http repository rule --- testing/core/MODULE.bazel | 2 ++ testing/core/tests/BUILD.bazel | 1 + testing/core/tests/nixpkgs_repositories.bzl | 14 ++++++++++++++ 3 files changed, 17 insertions(+) diff --git a/testing/core/MODULE.bazel b/testing/core/MODULE.bazel index cdb8ce09b..d87c68b4f 100644 --- a/testing/core/MODULE.bazel +++ b/testing/core/MODULE.bazel @@ -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") @@ -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") diff --git a/testing/core/tests/BUILD.bazel b/testing/core/tests/BUILD.bazel index 9d6a39763..3327e8ba2 100644 --- a/testing/core/tests/BUILD.bazel +++ b/testing/core/tests/BUILD.bazel @@ -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", ] diff --git a/testing/core/tests/nixpkgs_repositories.bzl b/testing/core/tests/nixpkgs_repositories.bzl index 692a91303..d58d33433 100644 --- a/testing/core/tests/nixpkgs_repositories.bzl +++ b/testing/core/tests/nixpkgs_repositories.bzl @@ -1,6 +1,7 @@ load( "@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_git_repository", + "nixpkgs_http_repository", "nixpkgs_local_repository", "nixpkgs_package", ) @@ -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", @@ -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 {}; hello",