Skip to content

Commit 8ae278f

Browse files
committed
Restore short repository labels
Before #29, we'd write ```python nixpkgs_package(name = "hello", repository = "@nixpkgs") ``` and this would just work. Now we write ```python nixpkgs_package(name = "hello", repositories = { "nixpkgs": "@nixpkgs//:default.nix" }) ``` which is quite a bit more verbose. With this fix, writing the repository label as `"@nixpkgs"` works again. Fixes #41.
1 parent f92d52a commit 8ae278f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ nixpkgs_git_repository(
1818

1919
nixpkgs_package(
2020
name = "nixpkgs-git-repository-test",
21-
repositories = { "nixpkgs": "@remote_nixpkgs//:default.nix" },
21+
repositories = { "nixpkgs": "@remote_nixpkgs" },
2222
attribute_path = "hello",
2323
)
2424

nixpkgs/nixpkgs.bzl

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
44

55
def _nixpkgs_git_repository_impl(repository_ctx):
66
repository_ctx.file('BUILD')
7-
# XXX Hack because repository_ctx.path below bails out if resolved path not a regular file.
8-
repository_ctx.file(repository_ctx.name)
7+
# Make "@nixpkgs" (syntactic sugar for "@nixpkgs//:nixpkgs") a valid
8+
# label for default.nix.
9+
repository_ctx.symlink("default.nix", repository_ctx.name)
910
repository_ctx.download_and_extract(
1011
url = "%s/archive/%s.tar.gz" % (repository_ctx.attr.remote, repository_ctx.attr.revision),
1112
stripPrefix = "nixpkgs-" + repository_ctx.attr.revision,

0 commit comments

Comments
 (0)