Skip to content

Commit 65b3bac

Browse files
committed
Fail if neither 'repository' nor 'path' ar set
This ensures that it will not use whatever nixpkgs channel is available, hence build are trully reproducible.
1 parent 2681ad5 commit 65b3bac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

nixpkgs/nixpkgs.bzl

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@ def _nixpkgs_package_impl(ctx):
4949

5050
# If neither repository or path are set, leave empty which will use
5151
# default value from NIX_PATH.
52-
path = []
5352
if ctx.attr.repository and ctx.attr.path:
5453
fail("'repository' and 'path' fields are mutually exclusive.")
55-
if ctx.attr.repository:
54+
elif ctx.attr.repository:
5655
# XXX Another hack: the repository label typically resolves to
5756
# some top-level package in the external workspace. So we use
5857
# dirname to get the actual workspace path.
5958
path = ["-I", "nixpkgs={0}".format(ctx.path(ctx.attr.repository).dirname)]
60-
if ctx.attr.path:
59+
elif ctx.attr.path:
6160
path = ["-I", "nixpkgs={0}".format(ctx.attr.path)]
61+
else:
62+
fail("""You *must* specify one of 'repository' or 'path'.""")
6263

6364
nix_build_path = ctx.which("nix-build")
6465
if nix_build_path == None:

0 commit comments

Comments
 (0)