treewide: remove FHSEnv

To remove the FHSenv, we have to patch rules_python to use
/usr/bin/env to resolve the path to bash instead of hardcoding it.
Additionally, we now bring a Nix-compatible Bazel 8.

Change-Id: Id51e7748eea6dd77185f43a52fe45b5110ba4a2b
Reviewed-on: https://review.monogon.dev/c/monogon/+/4427
Tested-by: Jenkins CI
Reviewed-by: Jan Schär <jan@monogon.tech>
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/third_party/edk2/def.bzl b/third_party/edk2/def.bzl
index 3e8c09f..b1a8bd6 100644
--- a/third_party/edk2/def.bzl
+++ b/third_party/edk2/def.bzl
@@ -16,6 +16,7 @@
 ]
 
 def _edk2_impl(ctx):
+    py_runtime = ctx.toolchains["@bazel_tools//tools/python:toolchain_type"].py3_runtime
     _, libuuid_gen = detect_roots(ctx.attr._libuuid[CcInfo].compilation_context.direct_public_headers)
     extra_env = {
         "HOSTLDFLAGS": " -L ".join(
@@ -32,6 +33,7 @@
         ),
         "CROSS_LIB_UUID_INC": libuuid_gen.rsplit("/", 1)[0],
         "CROSS_LIB_UUID": detect_root(ctx.attr._libuuid.files.to_list()).rsplit("/", 1)[0],
+        "PYTHON_COMMAND": py_runtime.interpreter.path,
     }
 
     inputs = depset(
@@ -72,7 +74,7 @@
     vars = ctx.actions.declare_file("VARS.fd")
     ctx.actions.run_shell(
         outputs = [code, vars],
-        inputs = depset(transitive = [inputs, toolchain_inputs]),
+        inputs = depset(transitive = [inputs, toolchain_inputs, py_runtime.files]),
         env = merge_env(toolchain_env, extra_env),
         progress_message = "Building EDK2 firmware",
         mnemonic = "BuildEDK2Firmware",
@@ -135,5 +137,7 @@
         ),
     },
     fragments = ["cpp"],
-    toolchains = TOOLCHAINS + use_cc_toolchain(),
+    toolchains = [
+        "@bazel_tools//tools/python:toolchain_type",
+    ] + TOOLCHAINS + use_cc_toolchain(),
 )