From 77a1edaa59877a064f85eabaf4a3e596ba1b7b9e Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Sat, 18 May 2024 14:20:25 +0200 Subject: [PATCH] Upgrade rules_nixpkgs to 0.11.1 rules_haskell 0.19 depends on rules_nixpkgs 0.10, but we need the fix https://github.com/tweag/rules_nixpkgs/issues/421 to avoid error: ``` panic: rulesGoStdlibPrefix should have been set via -X ``` Also, load only the needed toolchain rules from rules_nixpkgs. --- WORKSPACE.bazel | 30 +++++++++++++++++++++++++++++- flake.nix | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index d268182..4ffa21b 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -16,6 +16,13 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() +http_archive( + name = "io_tweag_rules_nixpkgs", + sha256 = "2a555348d7f8593fca2bf3fc6ce53c5d62929de81b6c292e23f16c557c0ae45a", + strip_prefix = "rules_nixpkgs-0.11.1", + urls = ["https://github.com/tweag/rules_nixpkgs/releases/download/v0.11.1/rules_nixpkgs-0.11.1.tar.gz"], +) + # Download rules_haskell and make it accessible as "@rules_haskell". http_archive( name = "rules_haskell", @@ -40,6 +47,21 @@ load("@rules_sh//sh:posix.bzl", "sh_posix_configure") # Bring in a "local" toolchain - (only hermetic if in a pure nix-shell!) sh_posix_configure() +# Add rules_nixpkgs toolchains +load( + "@io_tweag_rules_nixpkgs//nixpkgs:repositories.bzl", + "rules_nixpkgs_dependencies", +) + +rules_nixpkgs_dependencies( + toolchains = [ + "cc", + "go", + "python", + "posix", + ], +) + load( "@rules_haskell//haskell:repositories.bzl", "rules_haskell_dependencies", @@ -51,9 +73,15 @@ rules_haskell_dependencies() # Load nixpkgs_git_repository from rules_nixpkgs, # which was already initialized by rules_haskell_dependencies above. load( - "@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", + "@rules_nixpkgs_cc//:cc.bzl", "nixpkgs_cc_configure", +) +load( + "@rules_nixpkgs_core//:nixpkgs.bzl", "nixpkgs_local_repository", +) +load( + "@rules_nixpkgs_python//:python.bzl", "nixpkgs_python_configure", ) diff --git a/flake.nix b/flake.nix index 67b0524..abf5de8 100644 --- a/flake.nix +++ b/flake.nix @@ -78,7 +78,7 @@ nativeBuildInputs = nativeBuildInputs ++ [ ghc ]; fetchAttrs = { - sha256 = "sha256-ZyP1umO8wqcwEaP5tYCtGDGfCztK3naZmmrWx/rGBao="; + sha256 = "sha256-u2bC9SUJEJd4RCrnZhIRKtLcyesyxe94hnwsBI8+3s4="; }; buildAttrs = {