refactor: make Orion sole transcription owner
This commit is contained in:
1 parent
b38fb9e12a
commit
01c885589d
2 files changed
+4
-20
No files matched your search
@@ -11,7 +11,6 @@ in
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
isOrion = config.facts.machine.name == "orion";
|
|
||||||
modelName = "large-v3-turbo-q5_0";
|
modelName = "large-v3-turbo-q5_0";
|
||||||
modelHash = "sha256-OUIhcJzVrR9AxG5gMcphvOiJMebgiMGIKUxtWlX/p+I=";
|
modelHash = "sha256-OUIhcJzVrR9AxG5gMcphvOiJMebgiMGIKUxtWlX/p+I=";
|
||||||
modelSha256 = builtins.convertHash {
|
modelSha256 = builtins.convertHash {
|
||||||
@@ -38,8 +37,7 @@ in
|
|||||||
${builtins.readFile ./_diarize-transcript.py}
|
${builtins.readFile ./_diarize-transcript.py}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
whisper = if isOrion then pkgs.whisper-cpp else pkgs.whisper-cpp-vulkan;
|
whisper = pkgs.whisper-cpp;
|
||||||
acceleration = if isOrion then "CPU" else "Vulkan";
|
|
||||||
prepareDiarizationModel = pkgs.writeShellApplication {
|
prepareDiarizationModel = pkgs.writeShellApplication {
|
||||||
name = "prepare-transcription-diarization-model";
|
name = "prepare-transcription-diarization-model";
|
||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
@@ -104,7 +102,7 @@ in
|
|||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = lib.getExe transcribeRecordings;
|
ExecStart = lib.getExe transcribeRecordings;
|
||||||
Environment = [
|
Environment = [
|
||||||
"TRANSCRIBE_ENGINE_ACCELERATION=${acceleration}"
|
"TRANSCRIBE_ENGINE_ACCELERATION=CPU"
|
||||||
"TRANSCRIBE_ENGINE_VERSION=${whisper.version}"
|
"TRANSCRIBE_ENGINE_VERSION=${whisper.version}"
|
||||||
"TRANSCRIBE_MODEL=${model}"
|
"TRANSCRIBE_MODEL=${model}"
|
||||||
''"TRANSCRIBE_MODEL_NAME=${modelName} multilingual"''
|
''"TRANSCRIBE_MODEL_NAME=${modelName} multilingual"''
|
||||||
@@ -116,16 +114,14 @@ in
|
|||||||
"TRANSCRIBE_SETTLE_SECONDS=300"
|
"TRANSCRIBE_SETTLE_SECONDS=300"
|
||||||
"TRANSCRIBE_SYNC_ROOT=${home}/sync"
|
"TRANSCRIBE_SYNC_ROOT=${home}/sync"
|
||||||
];
|
];
|
||||||
}
|
|
||||||
// lib.optionalAttrs isOrion {
|
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = 60;
|
RestartSec = 60;
|
||||||
};
|
};
|
||||||
|
|
||||||
Install.WantedBy = lib.optionals isOrion [ "default.target" ];
|
Install.WantedBy = [ "default.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.paths.transcribe-recordings = lib.mkIf isOrion {
|
systemd.user.paths.transcribe-recordings = {
|
||||||
Unit.Description = "Watch for synchronized recordings";
|
Unit.Description = "Watch for synchronized recordings";
|
||||||
|
|
||||||
Path = {
|
Path = {
|
||||||
@@ -135,17 +131,6 @@ in
|
|||||||
|
|
||||||
Install.WantedBy = [ "paths.target" ];
|
Install.WantedBy = [ "paths.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.timers.transcribe-recordings = lib.mkIf (!isOrion) {
|
|
||||||
Unit.Description = "Transcribe new recordings every two minutes";
|
|
||||||
|
|
||||||
Timer = {
|
|
||||||
OnCalendar = "*:0/2";
|
|
||||||
Persistent = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
Install.WantedBy = [ "timers.target" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.nixos.transcription =
|
flake.modules.nixos.transcription =
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ in
|
|||||||
imports = [
|
imports = [
|
||||||
nixosModules.workstation-base
|
nixosModules.workstation-base
|
||||||
nixosModules.laptop-power
|
nixosModules.laptop-power
|
||||||
nixosModules.transcription
|
|
||||||
{
|
{
|
||||||
hardware.enableRedistributableFirmware = true;
|
hardware.enableRedistributableFirmware = true;
|
||||||
services.fwupd.enable = true;
|
services.fwupd.enable = true;
|
||||||
|
|||||||
Reference in new issue
Block a user