env/tools: fix NixOS detection, maybe

Change-Id: Ifa4c1c53ed918f67e68e190709edc417d0d3b4d6
diff --git a/env.sh b/env.sh
index 9b40724..374df77 100644
--- a/env.sh
+++ b/env.sh
@@ -16,6 +16,11 @@
 
 [[ ":$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
 }
diff --git a/tools/go_sdk.bzl b/tools/go_sdk.bzl
index 1884c42..3513b75 100644
--- a/tools/go_sdk.bzl
+++ b/tools/go_sdk.bzl
@@ -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",