From 0167ef5edc02535e8541fce3d2606b793e304825 Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Thu, 24 Oct 2019 13:53:33 +0200 Subject: [PATCH] Reduce timeout passed to repository_ctx.execute The old value was 2^30, the new value is 100 days. On macOS a too large timeout can lead to the error ``` ERROR: An error occurred during the fetch of repository 'node_nix': Traceback (most recent call last): File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 149 _execute_or_fail(repository_ctx, <3 more arguments>) File "/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/io_tweag_rules_nixpkgs/nixpkgs/nixpkgs.bzl", line 318, in _execute_or_fail fail(<1 more arguments>) Cannot build Nix attribute 'nodejs'. Command: [/Users/runner/.nix-profile/bin/nix-build, /private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/node_nix/nix/bazel.nix, "-A", "nodejs", "--out-link", "bazel-support/nix-out-link", "-I", "nixpkgs=/private/var/tmp/_bazel_runner/17d2b3954f1c6dcf5414d5453467df9a/external/nixpkgs/nixpkgs"] Return code: 1 Error output: src/main/tools/process-tools.cc:173: "setitimer": Invalid argument ``` See https://github.com/tweag/rules_nixpkgs/issues/92 --- nixpkgs/nixpkgs.bzl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index b52d94c57..a3d23d3bf 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -144,8 +144,9 @@ def _nixpkgs_package_impl(repository_ctx): # Large enough integer that Bazel can still parse. We don't have # access to MAX_INT and 0 is not a valid timeout so this is as good - # as we can do. - timeout = 1073741824 + # as we can do. The value shouldn't be too large to avoid errors on + # macOS, see https://github.com/tweag/rules_nixpkgs/issues/92. + timeout = 8640000 exec_result = _execute_or_fail( repository_ctx, nix_build,