nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 curl,
3 netlify-cli,
4 runCommand,
5}:
6
7runCommand "netlify-cli-test" {
8 nativeBuildInputs = [
9 netlify-cli
10 curl
11 ];
12 meta.timeout = 600;
13} ''
14 mkdir home
15 export HOME=$PWD/home
16
17 # Create a simple site
18 echo '<h1>hi</h1>' >index.html
19 echo '/with-redirect /' >_redirects
20
21 # Start a local server and wait for it to respond
22 netlify dev --offline --port 8888 2>&1 | tee log &
23 sleep 0.1 || true
24 for (( i=0; i<300; i++ )); do
25 if grep --ignore-case 'Server now ready' <log; then
26 break
27 else
28 sleep 1
29 fi
30 done
31
32 # Test the local server
33 curl -L http://localhost:8888/with-redirect | grep '<h1>hi</h1>'
34
35 # Success
36 touch $out
37''