diff --git a/PulumiWebServer/.gitignore b/PulumiWebServer/.gitignore new file mode 100644 index 0000000..f7275bb --- /dev/null +++ b/PulumiWebServer/.gitignore @@ -0,0 +1 @@ +venv/ diff --git a/PulumiWebServer/Domain.fs b/PulumiWebServer/Domain.fs index b463e4b..86a0ed7 100644 --- a/PulumiWebServer/Domain.fs +++ b/PulumiWebServer/Domain.fs @@ -102,6 +102,7 @@ type WellKnownSubdomain = | WoodpeckerAgent | Grafana | PureGym + | Whisper override this.ToString () = match this with @@ -113,6 +114,7 @@ type WellKnownSubdomain = | Woodpecker -> "woodpecker" | WoodpeckerAgent -> "woodpecker-agent" | PureGym -> "puregym" + | Whisper -> "whisper" static member Parse (s : string) = match s with @@ -124,6 +126,7 @@ type WellKnownSubdomain = | "woodpecker-agent" -> WellKnownSubdomain.WoodpeckerAgent | "grafana" -> WellKnownSubdomain.Grafana | "puregym" -> WellKnownSubdomain.PureGym + | "whisper" -> WellKnownSubdomain.Whisper | _ -> failwith $"Failed to deserialise: {s}" diff --git a/PulumiWebServer/Nix/configuration.nix b/PulumiWebServer/Nix/configuration.nix index 33e73b4..472c985 100644 --- a/PulumiWebServer/Nix/configuration.nix +++ b/PulumiWebServer/Nix/configuration.nix @@ -2,6 +2,7 @@ nixpkgs, website, puregym-client, + whisper-packages, ... }: let lib = nixpkgs.lib; @@ -24,6 +25,7 @@ in { # generated at runtime by nixos-infect and copied here ./hardware-configuration.nix ./networking.nix + ./whisper/whisper.nix ]; services.radicale-config.domain = userConfig.domain; @@ -47,6 +49,8 @@ in { services.prometheus-config.domain-exporter-domains = [userConfig.domain]; services.puregym-config.domain = userConfig.domain; services.puregym-config.subdomain = "puregym"; + services.whisper-config.domain = userConfig.domain; + services.whisper-config.subdomain = "whisper"; services.journald.extraConfig = "SystemMaxUse=100M"; diff --git a/PulumiWebServer/Nix/flake.lock b/PulumiWebServer/Nix/flake.lock index ec2849e..c719447 100644 --- a/PulumiWebServer/Nix/flake.lock +++ b/PulumiWebServer/Nix/flake.lock @@ -99,6 +99,24 @@ "inputs": { "systems": "systems_3" }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_4" + }, "locked": { "lastModified": 1694529238, "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", @@ -113,6 +131,24 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -120,11 +156,11 @@ ] }, "locked": { - "lastModified": 1703795120, - "narHash": "sha256-Scr4fwfGn03zwFgM7IltT8hqbFDkHvymnF5AaR4eDAg=", + "lastModified": 1705660020, + "narHash": "sha256-1tOuNh+UbiZlaC8RrpQzzypgnLBC67eRlBunfkE4sbQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "ba6b75011b44e85b1b755b6c423f85d0817645f7", + "rev": "2064348e555b6aa963da6372a8f14e6acb80a176", "type": "github" }, "original": { @@ -139,17 +175,15 @@ "website", "flake-utils" ], - "nixpkgs": [ - "website", - "nixpkgs" - ], + "nixpkgs": "nixpkgs_5", "scripts": "scripts_2" }, "locked": { - "dirtyRev": "9e2f5603f1e4e263e73ae0d0ca7c86ae14427c73-dirty", - "dirtyShortRev": "9e2f560-dirty", - "lastModified": 1701513782, - "narHash": "sha256-dDym75Eq6TIw9IrokBWwSoto0/l3nxFGpH4/VZkeqrQ=", + "lastModified": 1704152342, + "narHash": "sha256-9ntmhbkkmZSoaVMYPmZ/HkzYphpIHIBrWv5viO2Ee48=", + "ref": "refs/heads/main", + "rev": "882c5d5703e639a1318ea4e69f3b8cbbfacfb3a0", + "revCount": 19, "type": "git", "url": "file:/Users/patrick/Desktop/website/static-site-images" }, @@ -160,21 +194,15 @@ }, "katex": { "inputs": { - "flake-utils": [ - "website", - "flake-utils" - ], - "nixpkgs": [ - "website", - "nixpkgs" - ] + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1696151934, - "narHash": "sha256-8kihcqdgYjoVuGozfgfcWh81yqMUvns4+C/fgkn+RNQ=", + "lastModified": 1704150937, + "narHash": "sha256-G6uJKkY5VErgobe51IIbp/ugHDIhVx5e0xNjJ90JEOk=", "owner": "Smaug123", "repo": "KaTeX", - "rev": "ac1f9b30441f63ea20216a36ffa7148dc0e9a9b3", + "rev": "b74ed701beec2bebd161a0b5ea30c496c5206b96", "type": "github" }, "original": { @@ -184,13 +212,25 @@ "type": "github" } }, + "model": { + "flake": false, + "locked": { + "narHash": "sha256-CSrDFPoQgkvBW36keGkYpjxz740TBrCKVSxwSnfYvV8=", + "type": "file", + "url": "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin?download=true" + }, + "original": { + "type": "file", + "url": "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin?download=true" + } + }, "nixpkgs": { "locked": { - "lastModified": 1703467016, - "narHash": "sha256-/5A/dNPhbQx/Oa2d+Get174eNI3LERQ7u6WTWOlR1eQ=", + "lastModified": 1705458851, + "narHash": "sha256-uQvEhiv33Zj/Pv364dTvnpPwFSptRZgVedDzoM+HqVg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d02d818f22c777aa4e854efc3242ec451e5d462a", + "rev": "8bf65f17d8070a0a490daf5f1c784b87ee73982c", "type": "github" }, "original": { @@ -202,11 +242,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1703351344, - "narHash": "sha256-9FEelzftkE9UaJ5nqxidaJJPEhe9TPhbypLHmc2Mysc=", + "lastModified": 1705033721, + "narHash": "sha256-K5eJHmL1/kev6WuqyqqbS1cdNnSidIZ3jeqJ7GbrYnQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7790e078f8979a9fcd543f9a47427eeaba38f268", + "rev": "a1982c92d8980a0114372973cbdfe0a307f1bdea", "type": "github" }, "original": { @@ -233,11 +273,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1703134684, - "narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=", + "lastModified": 1704842529, + "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d6863cbcbbb80e71cecfc03356db1cda38919523", + "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5", "type": "github" }, "original": { @@ -262,6 +302,52 @@ "type": "github" } }, + "nixpkgs_5": { + "locked": { + "lastModified": 1704150997, + "narHash": "sha256-HbBTRybyqmd2/OMHIA6bV8HNXpcwB/t49be2kBq13IE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2df2bddf079263a6da2eb1876c7e212188ff950c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1688392541, + "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1695033101, + "narHash": "sha256-RQ4m+ycjdLdass7Hr4+Lzwnjw7wGhcUkKqWiJS3YxPM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d941d9491804e0ca01e03468dbf6f8d3a7919a16", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, "pdfs": { "inputs": { "flake-utils": [ @@ -294,11 +380,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1703797686, - "narHash": "sha256-4HZ+uz7LFK+44IzKuLe9lL34Oau/J1Tppmxpe+x5FCw=", + "lastModified": 1703937582, + "narHash": "sha256-M4y/xbrocPoLwG4qUUdCoBvOHumPAGlMoeo8SpWjn0M=", "ref": "refs/heads/main", - "rev": "8ece87ff57b0ae66f38120d8a26b33661625fa61", - "revCount": 5, + "rev": "cdbc73b07f3cac88e446fbe73c4b0c6616448319", + "revCount": 8, "type": "git", "url": "https://gitea.patrickstevens.co.uk/patrick/puregym-unofficial-dotnet" }, @@ -313,7 +399,8 @@ "nixpkgs": "nixpkgs", "puregym-client": "puregym-client", "sops": "sops", - "website": "website" + "website": "website", + "whisper-packages": "whisper-packages" } }, "scripts": { @@ -382,11 +469,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1703387502, - "narHash": "sha256-JnWuQmyanPtF8c5yAEFXVWzaIlMxA3EAZCh8XNvnVqE=", + "lastModified": 1705356877, + "narHash": "sha256-274jL1cH64DcXUXebVMZBRUsTs3FvFlPIPkCN/yhSnI=", "owner": "Mic92", "repo": "sops-nix", - "rev": "e523e89763ff45f0a6cf15bcb1092636b1da9ed3", + "rev": "87755331580fdf23df7e39b46d63ac88236bf42c", "type": "github" }, "original": { @@ -440,6 +527,36 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "website": { "inputs": { "anki-decks": "anki-decks", @@ -454,11 +571,11 @@ "scripts": "scripts_4" }, "locked": { - "lastModified": 1701514896, - "narHash": "sha256-XDhco86dHsoHzezarG1UQBpsCyZ+AqRY+w+l3g4hL1o=", + "lastModified": 1705693021, + "narHash": "sha256-Ew7yxjYvwG9IE6YNPxcHNQUn2T8es1yWoK/f+x7UyCM=", "owner": "Smaug123", "repo": "static-site-pipeline", - "rev": "b35c219d0e3e93b5bbd52befa486b54fa4e8b710", + "rev": "da3a4d2e53e3068755fcd49b74bcfcf2800c197d", "type": "github" }, "original": { @@ -466,6 +583,27 @@ "repo": "static-site-pipeline", "type": "github" } + }, + "whisper-packages": { + "inputs": { + "flake-utils": "flake-utils_5", + "model": "model", + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1704121990, + "narHash": "sha256-ss1gDu3C7anyqEo0ksDuOPgcsD3EOUqtCwAt8ei6rM4=", + "owner": "Smaug123", + "repo": "whisper.cpp", + "rev": "2ff0257983b4a3fe9cece30b215ba2b5087f2613", + "type": "github" + }, + "original": { + "owner": "Smaug123", + "ref": "nix-small", + "repo": "whisper.cpp", + "type": "github" + } } }, "root": "root", diff --git a/PulumiWebServer/Nix/flake.nix b/PulumiWebServer/Nix/flake.nix index 1b3019a..eabb610 100644 --- a/PulumiWebServer/Nix/flake.nix +++ b/PulumiWebServer/Nix/flake.nix @@ -13,6 +13,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; sops.url = "github:Mic92/sops-nix"; + whisper-packages.url = "github:Smaug123/whisper.cpp/nix-small"; }; outputs = { @@ -22,6 +23,7 @@ home-manager, website, puregym-client, + whisper-packages, } @ inputs: let system = "x86_64-linux"; in { @@ -31,6 +33,7 @@ inherit system; website = website.packages.${system}.default; puregym-client = puregym-client.packages.${system}.default; + whisper-packages = whisper-packages.packages.${system}; }; modules = [ (import ./configuration.nix (inputs // {inherit inputs;})) diff --git a/PulumiWebServer/Nix/whisper/requirements.txt b/PulumiWebServer/Nix/whisper/requirements.txt new file mode 100644 index 0000000..4319354 --- /dev/null +++ b/PulumiWebServer/Nix/whisper/requirements.txt @@ -0,0 +1,2 @@ +flask +waitress diff --git a/PulumiWebServer/Nix/whisper/transcribe.html b/PulumiWebServer/Nix/whisper/transcribe.html new file mode 100644 index 0000000..c2097e6 --- /dev/null +++ b/PulumiWebServer/Nix/whisper/transcribe.html @@ -0,0 +1,107 @@ + + +
+Submit file for transcription
+ + +