From 6d1ae586752bfdce4c6152078304413fc3000a5f Mon Sep 17 00:00:00 2001 From: Guillaume Bouchard Date: Mon, 3 Jun 2019 10:13:35 +0200 Subject: [PATCH] Add overlays as suggested by @aherrmann --- WORKSPACE | 6 +++--- nixpkgs/nixpkgs.bzl | 8 ++++---- shell.nix | 2 +- tests/hello.nix | 2 +- tests/nixpkgs.nix | 2 +- tests/output.nix | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index e92fcd1ea..9cf74d716 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -36,7 +36,7 @@ nixpkgs_package( nixpkgs_package( name = "expr-test", - nix_file_content = "let pkgs = import { config = {}; }; in pkgs.hello", + nix_file_content = "let pkgs = import { config = {}; overlays = []; }; in pkgs.hello", # Deliberately not @nixpkgs, to test whether explict file works. repositories = {"nixpkgs": "//:nixpkgs.nix"}, ) @@ -50,7 +50,7 @@ nixpkgs_package( nixpkgs_package( name = "expr-attribute-test", attribute_path = "hello", - nix_file_content = "import { config = {}; }", + nix_file_content = "import { config = {}; overlays = []; }", repository = "@nixpkgs", ) @@ -77,7 +77,7 @@ nixpkgs_package( nixpkgs_package( name = "extra-args-test", nix_file_content = """ -{ packagePath }: (import { config = {}; }).${packagePath} +{ packagePath }: (import { config = {}; overlays = []; }).${packagePath} """, repository = "@nixpkgs", nixopts = ["--argstr", "packagePath", "hello"], diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index 7543b72c6..0ceaa8fc4 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -97,7 +97,7 @@ def _nixpkgs_package_impl(repository_ctx): elif not repositories: fail(strFailureImplicitNixpkgs) else: - expr_args = ["-E", "import { config = {}; }"] + expr_args = ["-E", "import { config = {}; overlays = []; }"] _symlink_nix_file_deps(repository_ctx, repository_ctx.attr.nix_file_deps) @@ -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()))) @@ -372,7 +372,7 @@ def nixpkgs_cc_configure( """ if not nix_file and not nix_file_content: nix_file_content = """ - with import { config = {}; }; buildEnv { + with import { config = {}; overlays = []; }; buildEnv { name = "bazel-cc-toolchain"; paths = [ stdenv.cc binutils ]; } diff --git a/shell.nix b/shell.nix index b90eab758..4a213dcc2 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? import ./nixpkgs.nix { config = {}; } }: +{ pkgs ? import ./nixpkgs.nix { config = {}; overlays = []; } }: with pkgs; diff --git a/tests/hello.nix b/tests/hello.nix index 5ba09870f..338b17a44 100644 --- a/tests/hello.nix +++ b/tests/hello.nix @@ -1,3 +1,3 @@ with import ./pkgname.nix; -let pkgs = import { config = {}; }; in builtins.getAttr pkgname pkgs +let pkgs = import { config = {}; overlays = []; }; in builtins.getAttr pkgname pkgs diff --git a/tests/nixpkgs.nix b/tests/nixpkgs.nix index b80f88994..fb0b6757c 100644 --- a/tests/nixpkgs.nix +++ b/tests/nixpkgs.nix @@ -1 +1 @@ -import { config = {}; } +import { config = {}; overlays = []; } diff --git a/tests/output.nix b/tests/output.nix index 89449f7e8..1c88f6063 100644 --- a/tests/output.nix +++ b/tests/output.nix @@ -1,4 +1,4 @@ -with import { config = {}; }; +with import { config = {}; overlays = []; }; runCommand "some-output" { preferLocalBuild = true;