This commit is contained in:
Lucy 2025-09-26 08:02:47 +02:00
commit 21e7d37205
15 changed files with 997 additions and 0 deletions

58
scripts/test-nix-build.sh Normal file
View file

@ -0,0 +1,58 @@
#!/usr/bin/env bash
echo "🧪 Testing Nix Web Development Setup..."
echo "======================================="
# Test if nix-instantiate can evaluate our test file
echo "📋 Running syntax validation..."
if nix-instantiate --eval --json test-build.nix > /dev/null 2>&1; then
echo "✅ Nix syntax validation passed"
else
echo "❌ Nix syntax validation failed"
echo "Error details:"
nix-instantiate --eval --json test-build.nix
exit 1
fi
# Test component evaluation
echo "🔧 Testing component system..."
nix-instantiate --eval --json --expr '
let
pkgs = import <nixpkgs> {};
html = import ./src/core/html.nix { inherit pkgs; };
css = import ./src/core/css.nix { inherit pkgs; };
components = import ./src/core/components.nix { inherit pkgs html css; };
in {
componentCount = builtins.length (builtins.attrNames components);
hasHeader = builtins.hasAttr "terminalHeader" components;
hasHero = builtins.hasAttr "heroSection" components;
}' | jq '.'
# Test page generation
echo "📄 Testing page generation..."
nix-instantiate --eval --json --expr '
let
pkgs = import <nixpkgs> {};
html = import ./src/core/html.nix { inherit pkgs; };
css = import ./src/core/css.nix { inherit pkgs; };
components = import ./src/core/components.nix { inherit pkgs html css; };
content = import ./src/data/content.nix;
page = import ./src/pages/index.nix { inherit components content; };
in {
hasHtml = builtins.isString page.html;
htmlLength = builtins.stringLength page.html;
}' | jq '.'
# Test CSS generation
echo "🎨 Testing CSS generation..."
nix-instantiate --eval --json --expr '
let
styles = import ./src/styles/main.nix;
in {
hasCss = builtins.isString styles.css;
cssLength = builtins.stringLength styles.css;
}' | jq '.'
echo ""
echo "🎉 All tests completed!"
echo "💡 Run 'generate-site' to build the full website"