added mods

This commit is contained in:
Errol Sancaktar 2025-01-19 18:23:54 -07:00
parent a55c2c66bf
commit 60fe1c8f31
6 changed files with 151 additions and 3 deletions

View File

@ -16,5 +16,7 @@ in
"${modulesPath}/dhcp-proxy.nix"
"${modulesPath}/matter-bridge.nix"
"${modulesPath}/music-assistant.nix"
"${modulesPath}/piper.nix"
"${modulesPath}/whisper.nix"
];
}

View File

@ -11,7 +11,7 @@ let
PATH=$PATH:/run/current-system/sw/bin
# Define version variable
VERSION="6.6.0"
VERSION="7.0.1"
# Define the container ID file path
CIDFILE="/var/run/$SERVICE/$SERVICE.ctr-id"

View File

@ -11,7 +11,7 @@ let
PATH=$PATH:/run/current-system/sw/bin
# Define version variable
VERSION="2.3.3"
VERSION="2.3.6"
# Define the container ID file path
CIDFILE="/var/run/$SERVICE/$SERVICE.ctr-id"

73
nixos/modules/piper.nix Normal file
View File

@ -0,0 +1,73 @@
{ config, lib, pkgs, ... }:
let
# Define the start script
service = "Piper";
startScript = pkgs.writeScript "start-piper.sh" ''
#!/run/current-system/sw/bin/bash
SERVICE=${service}
# Update PATH
PATH=$PATH:/run/current-system/sw/bin
# Define version variable
VERSION="1.5.2"
CIDFILE="/var/run/$SERVICE/$SERVICE.ctr-id"
mkdir -p $(dirname $CIDFILE)
# Log the PATH
echo "Starting $SERVICE"
# Run the podman command
podman run --rm \
--cidfile=$CIDFILE \
--name $SERVICE \
--log-driver=journald \
--cgroups=no-conmon \
--sdnotify=conmon \
-d \
--replace \
-e TZ='America/Denver' \
-e WHISPER_MODEL=tiny-int8 \
-e WHISPER_BEAM=1 \
-e WHISPER_LANG=en \
-v /config/piper:/data \
-v /run/dbus:/run/dbus:ro \
-v /etc/localtime:/etc/localtime:ro \
--network=iotnet \
--dns=8.8.8.8 \
--publish=10200 \
rhasspy/wyoming-piper:$VERSION
'';
in
{
systemd.services.${service} = {
description = "${service} Podman Container";
serviceConfig = {
Type = "notify";
NotifyAccess="all";
ExecStart = "${startScript}";
ExecStop = "${pkgs.podman}/bin/podman stop --ignore -t 10 --cidfile=/var/run/${service}/${service}.ctr-id";
ExecStopPost="${pkgs.podman}/bin/podman rm -f --ignore -t 10 --cidfile=/var/run/${service}/${service}.ctr-id";
Restart="on-failure";
RestartSec=10;
TimeoutStartSec=300;
TimeoutStopSec=60;
RemainAfterExit=true;
RequiresMountsFor="/var/run/${service}";
After="network-online.target validate-nfs-mounts.service";
};
# Ensure that the service starts after network-related services are ready
after = [ "network-online.target" "validate-nfs-mounts.service" ];
requires = [ "network-online.target" "validate-nfs-mounts.service" ];
# No need to specify startLimitIntervalSec unless you want to limit the start attempts
startLimitIntervalSec = 0;
# Default target is a common choice, but you might want to use multi-user.target or another suitable target
wantedBy = [ "multi-user.target" ];
};
}

73
nixos/modules/whisper.nix Normal file
View File

@ -0,0 +1,73 @@
{ config, lib, pkgs, ... }:
let
# Define the start script
service = "Whisper";
startScript = pkgs.writeScript "start-whisper.sh" ''
#!/run/current-system/sw/bin/bash
SERVICE=${service}
# Update PATH
PATH=$PATH:/run/current-system/sw/bin
# Define version variable
VERSION="2.4.0-ls64"
CIDFILE="/var/run/$SERVICE/$SERVICE.ctr-id"
mkdir -p $(dirname $CIDFILE)
# Log the PATH
echo "Starting $SERVICE"
# Run the podman command
podman run --rm \
--cidfile=$CIDFILE \
--name $SERVICE \
--log-driver=journald \
--cgroups=no-conmon \
--sdnotify=conmon \
-d \
--replace \
-e TZ='America/Denver' \
-e WHISPER_MODEL=tiny-int8 \
-e WHISPER_BEAM=1 \
-e WHISPER_LANG=en \
-v /config/whisper:/config \
-v /run/dbus:/run/dbus:ro \
-v /etc/localtime:/etc/localtime:ro \
--network=iotnet \
--dns=8.8.8.8 \
--publish=10300 \
lscr.io/linuxserver/faster-whisper:$VERSION
'';
in
{
systemd.services.${service} = {
description = "${service} Podman Container";
serviceConfig = {
Type = "notify";
NotifyAccess="all";
ExecStart = "${startScript}";
ExecStop = "${pkgs.podman}/bin/podman stop --ignore -t 10 --cidfile=/var/run/${service}/${service}.ctr-id";
ExecStopPost="${pkgs.podman}/bin/podman rm -f --ignore -t 10 --cidfile=/var/run/${service}/${service}.ctr-id";
Restart="on-failure";
RestartSec=10;
TimeoutStartSec=300;
TimeoutStopSec=60;
RemainAfterExit=true;
RequiresMountsFor="/var/run/${service}";
After="network-online.target validate-nfs-mounts.service";
};
# Ensure that the service starts after network-related services are ready
after = [ "network-online.target" "validate-nfs-mounts.service" ];
requires = [ "network-online.target" "validate-nfs-mounts.service" ];
# No need to specify startLimitIntervalSec unless you want to limit the start attempts
startLimitIntervalSec = 0;
# Default target is a common choice, but you might want to use multi-user.target or another suitable target
wantedBy = [ "multi-user.target" ];
};
}

View File

@ -11,7 +11,7 @@ let
PATH=$PATH:/run/current-system/sw/bin
# Define version variable
VERSION="9.27.2"
VERSION="9.29.1"
# Define the container ID file path
CIDFILE="/var/run/$SERVICE/$SERVICE.ctr-id"