third_party/nix: symlink more files from host /etc

buildFHSEnv creates a tmpfs at /etc, mounts the host /etc at /.host-etc,
and then creates symlinks in /etc to /.host-etc for some files.
The list of files is here:
https://github.com/NixOS/nixpkgs/blob/24.11/pkgs/build-support/build-fhsenv-bubblewrap/default.nix#L57

This means that, after entering nix-shell, the /etc/bazel.bazelrc and
/etc/gitconfig files are missing. The list in buildFHSEnv is not
extensible by the user, so instead I create the additional symlinks in
wrapper.sh.

buildFHSUserEnv has been renamed to buildFHSEnv:
https://github.com/NixOS/nixpkgs/blob/7c0cdc746a0a1862133a49183f93cb80052b39e6/pkgs/top-level/aliases.nix#L376

Change-Id: I582156391e7636747fae1a20befb13aa290b80d6
Reviewed-on: https://review.monogon.dev/c/monogon/+/4212
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
Tested-by: Jenkins CI
diff --git a/third_party/nix/env.nix b/third_party/nix/env.nix
index 26130a1..320e3df 100644
--- a/third_party/nix/env.nix
+++ b/third_party/nix/env.nix
@@ -22,6 +22,14 @@
       # stripped by (host_)action_env.
       export BAZEL_SH=/bin/bash
 
+      # buildFHSEnv makes /etc a tmpfs and symlinks some files from host /etc.
+      # Create some additional symlinks for files we want from host /etc.
+      for i in bazel.bazelrc gitconfig; do
+          if [[ -e "/.host-etc/$i" ]] && [[ ! -e "/etc/$i" ]]; then
+              ln -s "/.host-etc/$i" "/etc/$i"
+          fi
+      done
+
       ${extraConf}
 
       # Allow passing a custom command via env since nix-shell doesn't support
@@ -32,7 +40,7 @@
       exec $COMMAND
     '';
 in
-(pkgs.buildFHSUserEnv {
+(pkgs.buildFHSEnv {
   name = "monogon-nix";
   targetPkgs = pkgs: with pkgs; [
     git