1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
Files
niveum/systems/makanek/horoscopy.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

2022-02-11 17:01:12 +01:00
{ pkgs, lib, ... }:
let
port = 5040;
punkt = pkgs.fetchzip {
url = "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/tokenizers/punkt.zip";
sha256 = "113cv87dj5ml7g8pjm7psk4q1hrf0zqpmc945lmpdz91vp2wn1nc";
};
horoscopy-src = pkgs.fetchzip {
url = "http://c.krebsco.de/horoscopy.tar.gz";
hash = "sha256-DMhPDSftSaQomnEf+/XBn6cYIAJbs8BBJUGSi9NHLr4=";
stripRoot = false;
};
horoscopy = import horoscopy-src;
in
{
systemd.services.horoscopy = {
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
description = "AI astrologer";
serviceConfig = {
DynamicUser = true;
};
environment.NLTK_DATA = pkgs.linkFarm "punkt-tokenizers" [
{ name = "tokenizers/punkt"; path = punkt; }
];
script = ''
cd ${horoscopy-src}
${horoscopy.dependencyEnv}/bin/gunicorn wsgi:app -b :${toString port}
'';
};
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
};
services.nginx.virtualHosts."horoscopy.kmein.de" = {
enableACME = true;
forceSSL = true;
locations."/".proxyPass = "http://127.0.0.1:${toString port}";
};
}