env/tools: fix NixOS detection, maybe

Change-Id: Ifa4c1c53ed918f67e68e190709edc417d0d3b4d6
This commit is contained in:
q3k 2020-02-17 23:04:35 +01:00
parent 3c14185ce4
commit c5a77b8f81
2 changed files with 9 additions and 1 deletions

5
env.sh
View file

@ -16,6 +16,11 @@ hscloud_path="$hscloud_root/bazel-bin/tools:$hscloud_root/bazel-bin/cluster/tool
[[ ":$PATH:" != *":$hscloud_path:"* ]] && PATH="$hscloud_path:${PATH}"
# Detect NixOS
if [ -d /nix ] && [ ! -f /lib/ld-linux.so.2 ]; then
hscloud_nixos=true
fi
gpg-unlock() {
echo "test" | gpg2 --sign --batch --no-tty -o /dev/null
}

View file

@ -1,7 +1,10 @@
def _gen_imports_impl(ctx):
ctx.file("BUILD", "")
is_nixos = "NIX_PATH" in ctx.os.environ
if "hscloud_root" not in ctx.os.environ:
fail("Please souce env.sh")
is_nixos = "hscloud_nixos" in ctx.os.environ
bzl_file_content = """
load(
"@io_bazel_rules_go//go:deps.bzl",