Refactor
This commit is contained in:
@@ -27,51 +27,51 @@ let
|
||||
};
|
||||
};
|
||||
in {
|
||||
sops = true; # Enabled to safeguard sensitive camera RTSP stream credentials
|
||||
db = false; # Internal SQLite is used by default in Frigate
|
||||
requires.secrets = [ name ];
|
||||
|
||||
paths = [
|
||||
{
|
||||
path = "${serverCfg.path.config}/frigate/";
|
||||
mode = "0755";
|
||||
}
|
||||
{
|
||||
path = "/var/lib/frigate/storage/";
|
||||
mode = "0755"; # Dedicated path for heavy video recordings and media
|
||||
}
|
||||
];
|
||||
runtime = {
|
||||
paths = [
|
||||
{
|
||||
path = "${serverCfg.path.config}/frigate/";
|
||||
mode = "0755";
|
||||
}
|
||||
{
|
||||
path = "/var/lib/frigate/storage/";
|
||||
mode = "0755"; # Dedicated path for heavy video recordings and media
|
||||
}
|
||||
];
|
||||
|
||||
containers = {
|
||||
server = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
imageStream = image;
|
||||
port = 5000;
|
||||
secret = name;
|
||||
extraEnv = {
|
||||
PLUS_API_KEY = ""; # Optional: For Frigate Plus users
|
||||
};
|
||||
overrides = {
|
||||
cmd = [ ];
|
||||
volumes = [
|
||||
"${serverCfg.path.config}/frigate:/config"
|
||||
"/var/lib/frigate/storage:/media/frigate"
|
||||
"/dev/bus/usb:/dev/bus/usb" # Passes Google Coral USB TPU to the container
|
||||
"/dev/dri:/dev/dri" # Passes Intel/AMD GPU for hardware video decoding
|
||||
];
|
||||
containers = {
|
||||
server = builder.mkContainer {
|
||||
subdomain = containerCfg.subdomain;
|
||||
imageStream = image;
|
||||
port = 5000;
|
||||
secret = name;
|
||||
extraEnv = {
|
||||
PLUS_API_KEY = ""; # Optional: For Frigate Plus users
|
||||
};
|
||||
overrides = {
|
||||
cmd = [ ];
|
||||
volumes = [
|
||||
"${serverCfg.path.config}/frigate:/config"
|
||||
"/var/lib/frigate/storage:/media/frigate"
|
||||
"/dev/bus/usb:/dev/bus/usb" # Passes Google Coral USB TPU to the container
|
||||
"/dev/dri:/dev/dri" # Passes Intel/AMD GPU for hardware video decoding
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
setup = {
|
||||
trigger = "server";
|
||||
envFile = config.sops.secrets."FRIGATE_ENV".path;
|
||||
script = pkgs.writeShellScript "setup-frigate" ''
|
||||
mkdir -p "${serverCfg.path.config}/frigate"
|
||||
mkdir -p "/var/lib/frigate/storage"
|
||||
|
||||
# Bootstrap a standard configuration layout if missing
|
||||
if [ ! -f "${serverCfg.path.config}/frigate/config.yml" ]; then
|
||||
cat <<EOF > "${serverCfg.path.config}/frigate/config.yml"
|
||||
setup = {
|
||||
trigger = "server";
|
||||
envFile = config.sops.secrets."FRIGATE_ENV".path;
|
||||
script = pkgs.writeShellScript "setup-frigate" ''
|
||||
mkdir -p "${serverCfg.path.config}/frigate"
|
||||
mkdir -p "/var/lib/frigate/storage"
|
||||
|
||||
# Bootstrap a standard configuration layout if missing
|
||||
if [ ! -f "${serverCfg.path.config}/frigate/config.yml" ]; then
|
||||
cat <<EOF > "${serverCfg.path.config}/frigate/config.yml"
|
||||
mqtt:
|
||||
enabled: False # Set to True and define host if connecting to Home Assistant
|
||||
|
||||
@@ -89,7 +89,8 @@ cameras:
|
||||
detect:
|
||||
enabled: false
|
||||
EOF
|
||||
fi
|
||||
'';
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user