Skip to content

Commit

Permalink
Add overlays as suggested by @aherrmann
Browse files Browse the repository at this point in the history
  • Loading branch information
guibou committed Jun 3, 2019
1 parent 9e8cd72 commit 6d1ae58
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nixpkgs_package(

nixpkgs_package(
name = "expr-test",
nix_file_content = "let pkgs = import <nixpkgs> { config = {}; }; in pkgs.hello",
nix_file_content = "let pkgs = import <nixpkgs> { config = {}; overlays = []; }; in pkgs.hello",
# Deliberately not @nixpkgs, to test whether explict file works.
repositories = {"nixpkgs": "//:nixpkgs.nix"},
)
Expand All @@ -50,7 +50,7 @@ nixpkgs_package(
nixpkgs_package(
name = "expr-attribute-test",
attribute_path = "hello",
nix_file_content = "import <nixpkgs> { config = {}; }",
nix_file_content = "import <nixpkgs> { config = {}; overlays = []; }",
repository = "@nixpkgs",
)

Expand All @@ -77,7 +77,7 @@ nixpkgs_package(
nixpkgs_package(
name = "extra-args-test",
nix_file_content = """
{ packagePath }: (import <nixpkgs> { config = {}; }).${packagePath}
{ packagePath }: (import <nixpkgs> { config = {}; overlays = []; }).${packagePath}
""",
repository = "@nixpkgs",
nixopts = ["--argstr", "packagePath", "hello"],
Expand Down
8 changes: 4 additions & 4 deletions nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _nixpkgs_package_impl(repository_ctx):
elif not repositories:
fail(strFailureImplicitNixpkgs)
else:
expr_args = ["-E", "import <nixpkgs> { config = {}; }"]
expr_args = ["-E", "import <nixpkgs> { config = {}; overlays = []; }"]

_symlink_nix_file_deps(repository_ctx, repository_ctx.attr.nix_file_deps)

Expand Down Expand Up @@ -239,9 +239,9 @@ nix_file_deps = [
"{deps_listing}",
]
Note: if it points to the nixpkgs global configuration file, such as ~/.config/nixpkgs/config.nix. You must force nixpkgs to not use the local configuration, by providing a `config` argument to your nixpkgs import, such as:
Note: if it points to the nixpkgs global configuration file, such as ~/.config/nixpkgs/config.nix. You must force nixpkgs to not use the local configuration, by providing at least a `config` and `overlays` arguments to your nixpkgs import, such as:
import (nixpkgs_path) {{ config = {{}}; }};
import (nixpkgs_path) {{ config = {{}}; overlays = {{}}; }};
""".format(repo_name = repository_ctx.name,
deps_listing = '",\n "'.join(deps_minus_declared_deps.keys())))

Expand Down Expand Up @@ -372,7 +372,7 @@ def nixpkgs_cc_configure(
"""
if not nix_file and not nix_file_content:
nix_file_content = """
with import <nixpkgs> { config = {}; }; buildEnv {
with import <nixpkgs> { config = {}; overlays = []; }; buildEnv {
name = "bazel-cc-toolchain";
paths = [ stdenv.cc binutils ];
}
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs ? import ./nixpkgs.nix { config = {}; } }:
{ pkgs ? import ./nixpkgs.nix { config = {}; overlays = []; } }:

with pkgs;

Expand Down
2 changes: 1 addition & 1 deletion tests/hello.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
with import ./pkgname.nix;
let pkgs = import <nixpkgs> { config = {}; }; in builtins.getAttr pkgname pkgs
let pkgs = import <nixpkgs> { config = {}; overlays = []; }; in builtins.getAttr pkgname pkgs

2 changes: 1 addition & 1 deletion tests/nixpkgs.nix
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import <nixpkgs> { config = {}; }
import <nixpkgs> { config = {}; overlays = []; }
2 changes: 1 addition & 1 deletion tests/output.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
with import <nixpkgs> { config = {}; };
with import <nixpkgs> { config = {}; overlays = []; };

runCommand "some-output" {
preferLocalBuild = true;
Expand Down

0 comments on commit 6d1ae58

Please sign in to comment.