Skip to content

Commit

Permalink
Fall back to regular coreutils on Darwin
Browse files Browse the repository at this point in the history
To prevent the following build error on MacOS x86_64
```
> error: don't yet have a `targetPackages.darwin.LibsystemCross for x86_64-apple-darwin`

ERROR: /Users/runner/work/rules_nixpkgs/rules_nixpkgs/WORKSPACE:45:16: fetching _nixpkgs_package rule //external:coreutils_static: Traceback (most recent call last):
  File "/private/var/tmp/_bazel_runner/a4a3182e50c9460fa52b8c6c1e6f916f/external/rules_nixpkgs_core/nixpkgs.bzl", line 589, column 31, in _nixpkgs_package_impl
    _nixpkgs_build_and_symlink(repository_ctx, [nix_build_path], expr_args, build_file_content)
  File "/private/var/tmp/_bazel_runner/a4a3182e50c9460fa52b8c6c1e6f916f/external/rules_nixpkgs_core/nixpkgs.bzl", line 447, column 34, in _nixpkgs_build_and_symlink
    exec_result = execute_or_fail(
  File "/private/var/tmp/_bazel_runner/a4a3182e50c9460fa52b8c6c1e6f916f/external/rules_nixpkgs_core/util.bzl", line 97, column 13, in execute_or_fail
    fail("""
Error in fail:
  Cannot build Nix derivation for package '@coreutils_static'.
    Command: "/nix/store/x5wfa3afc4l2rc7zx3wiiwcm5j3j4lbc-nix-2.17.0/bin/nix-build" "-I" "nixpkgs=/private/var/tmp/_bazel_runner/a4a3182e50c9460fa52b8c6c1e6f916f/external/nixpkgs/nixpkgs" "-E" "import <nixpkgs> { config = {}; overlays = []; }" "-A" "pkgsStatic.coreutils" "--out-link" "bazel-support/nix-out-link"
```
https://github.com/tweag/rules_nixpkgs/actions/runs/6390957120/job/17345262106?pr=423#step:6:846

Error message origin in nixpkgs:
https://github.com/aherrmann/nixpkgs/blob/59998678277cf465e749a144cf707021285bdf82/pkgs/top-level/all-packages.nix#L21799-L21802
  • Loading branch information
aherrmann committed Oct 3, 2023
1 parent 6cb237b commit fa796bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ nixpkgs_package(
# `run-test-invalid-nixpkgs-package`.
nixpkgs_package(
name = "coreutils_static",
attribute_path = "pkgsStatic.coreutils",
nix_file_content = "let pkgs = import <nixpkgs> { config = {}; overlays = []; }; in if pkgs.stdenv.isDarwn then pkgs.coreutils else pkgsStatic.coreutils",
repository = "@nixpkgs",
)

Expand Down

0 comments on commit fa796bf

Please sign in to comment.