mirror of
https://github.com/cachix/install-nix-action.git
synced 2025-09-21 15:49:12 +00:00
test: validate environment variables
Add a test to check that the environment is correctly set.
This commit is contained in:
parent
df46bbf819
commit
e298689725
2 changed files with 67 additions and 0 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -26,6 +26,8 @@ jobs:
|
|||
uses: ./
|
||||
with:
|
||||
nix_path: ${{ env.nixpkgs_channel }}
|
||||
- name: Test environment variables
|
||||
run: ./test-env.sh
|
||||
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
|
||||
- run: cat /etc/nix/nix.conf
|
||||
# cachix should be available and be able to configure a cache
|
||||
|
|
65
test-env.sh
Executable file
65
test-env.sh
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "=== Testing Nix Environment Variables ==="
|
||||
echo
|
||||
|
||||
# Test NIX_PROFILES
|
||||
echo "NIX_PROFILES: ${NIX_PROFILES:-<not set>}"
|
||||
if [[ -n "${NIX_PROFILES:-}" ]]; then
|
||||
echo "✓ NIX_PROFILES is set"
|
||||
else
|
||||
echo "✗ NIX_PROFILES is not set"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test NIX_SSL_CERT_FILE
|
||||
echo "NIX_SSL_CERT_FILE: ${NIX_SSL_CERT_FILE:-<not set>}"
|
||||
if [[ -n "${NIX_SSL_CERT_FILE:-}" ]]; then
|
||||
if [[ -f "$NIX_SSL_CERT_FILE" ]]; then
|
||||
echo "✓ NIX_SSL_CERT_FILE is set and file exists"
|
||||
else
|
||||
echo "⚠ NIX_SSL_CERT_FILE is set but file does not exist: $NIX_SSL_CERT_FILE"
|
||||
fi
|
||||
else
|
||||
echo "⚠ NIX_SSL_CERT_FILE is not set (may be OK depending on system)"
|
||||
fi
|
||||
|
||||
# Test PATH contains Nix paths
|
||||
echo "PATH: $PATH"
|
||||
if echo "$PATH" | grep -E -q "(\.nix-profile|nix/profile)"; then
|
||||
echo "✓ PATH contains Nix paths"
|
||||
else
|
||||
echo "✗ PATH does not contain Nix paths"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test NIX_PATH if set
|
||||
if [[ -n "${NIX_PATH:-}" ]]; then
|
||||
echo "NIX_PATH: $NIX_PATH"
|
||||
echo "✓ NIX_PATH is set"
|
||||
else
|
||||
echo "NIX_PATH: <not set>"
|
||||
fi
|
||||
|
||||
# Test TMPDIR
|
||||
echo "TMPDIR: ${TMPDIR:-<not set>}"
|
||||
if [[ -n "${TMPDIR:-}" ]]; then
|
||||
echo "✓ TMPDIR is set"
|
||||
else
|
||||
echo "⚠ TMPDIR is not set"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=== Testing Nix Command ==="
|
||||
if command -v nix >/dev/null 2>&1; then
|
||||
echo "✓ nix command is available"
|
||||
echo "Nix version: $(nix --version)"
|
||||
else
|
||||
echo "✗ nix command is not available"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "=== Environment Setup Test Complete ==="
|
Loading…
Add table
Add a link
Reference in a new issue