diff --git a/WORKSPACE b/WORKSPACE index 9cf74d71..0470bc04 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -96,4 +96,15 @@ filegroup( repository = "@nixpkgs", ) +nixpkgs_package( + name = "relative-imports", + attribute_path = "hello", + nix_file = "//tests:relative_imports.nix", + nix_file_deps = [ + "//:nixpkgs.nix", + "//tests:relative_imports/nixpkgs.nix", + ], + repository = "@nixpkgs", +) + nixpkgs_cc_configure(repository = "@remote_nixpkgs") diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 68e4f4c5..ef6e2fea 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -19,6 +19,7 @@ package(default_testonly = 1) "nix-file-test", "nix-file-deps-test", "nixpkgs-git-repository-test", + "relative-imports", ] ] + [ # These tests use the nix package generated by ./output.nix diff --git a/tests/relative_imports.nix b/tests/relative_imports.nix new file mode 100644 index 00000000..67f4b6e5 --- /dev/null +++ b/tests/relative_imports.nix @@ -0,0 +1,4 @@ +{ system ? builtins.currentSystem +, pkgs ? import relative_imports/nixpkgs.nix { inherit system; config = {}; overlays = []; } +}: +{ inherit (pkgs) hello; } diff --git a/tests/relative_imports/nixpkgs.nix b/tests/relative_imports/nixpkgs.nix new file mode 100644 index 00000000..40391a85 --- /dev/null +++ b/tests/relative_imports/nixpkgs.nix @@ -0,0 +1 @@ +import ../../nixpkgs.nix