|
254 | 254 | proxy_set_header Cookie $http_cookie; |
255 | 255 | proxy_set_header X-CSRF-TOKEN "1"; |
256 | 256 |
|
| 257 | + # Header used to validate reverse proxy trust |
| 258 | + proxy_set_header X-Proxy-Secret $http_x_proxy_secret; |
| 259 | +
|
257 | 260 | # Pass headers for common auth proxies |
258 | 261 | proxy_set_header Remote-User $http_remote_user; |
259 | 262 | proxy_set_header Remote-Groups $http_remote_groups; |
|
282 | 285 |
|
283 | 286 | add_header Cache-Control "no-store"; |
284 | 287 | expires off; |
| 288 | +
|
| 289 | + keepalive_disable safari; |
285 | 290 | ''; |
286 | 291 | }; |
287 | 292 | "/stream/" = { |
|
407 | 412 | proxyPass = "http://frigate-api"; |
408 | 413 | recommendedProxySettings = true; |
409 | 414 | extraConfig = nginxAuthRequest + nginxProxySettings + '' |
410 | | - rewrite ^/api/(.*)$ $1 break; |
| 415 | + rewrite ^/api/(.*)$ /$1 break; |
411 | 416 | ''; |
412 | 417 | }; |
413 | 418 | "/api/" = { |
|
443 | 448 | location /api/stats { |
444 | 449 | ${nginxAuthRequest} |
445 | 450 | access_log off; |
446 | | - rewrite ^/api/(.*)$ $1 break; |
| 451 | + rewrite ^/api(/.*)$ $1 break; |
447 | 452 | add_header Cache-Control "no-store"; |
448 | 453 | proxy_pass http://frigate-api; |
449 | 454 | ${nginxProxySettings} |
|
452 | 457 | location /api/version { |
453 | 458 | ${nginxAuthRequest} |
454 | 459 | access_log off; |
455 | | - rewrite ^/api/(.*)$ $1 break; |
| 460 | + rewrite ^/api(/.*)$ $1 break; |
456 | 461 | add_header Cache-Control "no-store"; |
457 | 462 | proxy_pass http://frigate-api; |
458 | 463 | ${nginxProxySettings} |
|
560 | 565 | "multi-user.target" |
561 | 566 | ]; |
562 | 567 | environment = { |
563 | | - CONFIG_FILE = format.generate "frigate.yml" filteredConfig; |
| 568 | + CONFIG_FILE = "/run/frigate/frigate.yml"; |
564 | 569 | HOME = "/var/lib/frigate"; |
565 | 570 | PYTHONPATH = cfg.package.pythonPath; |
566 | 571 | } // optionalAttrs (cfg.vaapiDriver != null) { |
|
578 | 583 | ] ++ optionals (!stdenv.hostPlatform.isAarch64) [ |
579 | 584 | # not available on aarch64-linux |
580 | 585 | intel-gpu-tools |
| 586 | + rocmPackages.rocminfo |
581 | 587 | ]; |
582 | 588 | serviceConfig = { |
583 | | - ExecStartPre = pkgs.writeShellScript "frigate-clear-cache" '' |
584 | | - rm --recursive --force /var/cache/frigate/* |
585 | | - ''; |
| 589 | + ExecStartPre = [ |
| 590 | + (pkgs.writeShellScript "frigate-clear-cache" '' |
| 591 | + rm --recursive --force /var/cache/frigate/* |
| 592 | + '') |
| 593 | + (pkgs.writeShellScript "frigate-create-writable-config" '' |
| 594 | + cp --no-preserve=mode "${format.generate "frigate.yml" filteredConfig}" /run/frigate/frigate.yml |
| 595 | + '') |
| 596 | + ]; |
586 | 597 | ExecStart = "${cfg.package.python.interpreter} -m frigate"; |
587 | 598 | Restart = "on-failure"; |
588 | 599 | SyslogIdentifier = "frigate"; |
|
0 commit comments