From b8d9878cea5a65e2e6ab4b98aace676f34038824 Mon Sep 17 00:00:00 2001 From: tzlil Date: Sat, 9 Sep 2023 01:47:07 +0300 Subject: add arxiv randomizer and some other crap i forgot --- hosts/vps/services/arXiv.nix | 41 +++++++++++++++++++++++++++++++++++++++++ hosts/vps/services/website.nix | 1 + 2 files changed, 42 insertions(+) create mode 100644 hosts/vps/services/arXiv.nix (limited to 'hosts/vps/services') diff --git a/hosts/vps/services/arXiv.nix b/hosts/vps/services/arXiv.nix new file mode 100644 index 0000000..4e45a11 --- /dev/null +++ b/hosts/vps/services/arXiv.nix @@ -0,0 +1,41 @@ +{ + pkgs, + config, + lib, + ... +}: { + systemd.services.arXiv-randomizer = let + python = pkgs.python3.withPackages (ps: + with ps; [ + beautifulsoup4 + dateutil + numpy + flask + feedparser + gunicorn + ]); + arXiv-randomizer = builtins.fetchGit { + url = "https://git.tzlil.net/arXiv.git"; + ref = "master"; + rev = "d09927ca6f7af2404e9c3a09a6e99dfdd1e87577"; + }; + in { + after = ["network.target"]; + wantedBy = ["multi-user.target"]; + script = "${lib.getExe python} -m gunicorn -w 5 --log-level debug -b 0.0.0.0:3000 --timeout 90 app:app"; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 0; + WorkingDirectory="${arXiv-randomizer}"; + }; + }; + + services.caddy = { + virtualHosts."tzlil.net".extraConfig = '' + redir /arXiv /arXiv/ + handle_path /arXiv/* { + reverse_proxy :3000 + } + ''; + }; +} diff --git a/hosts/vps/services/website.nix b/hosts/vps/services/website.nix index 8f15df1..f3ef7b8 100644 --- a/hosts/vps/services/website.nix +++ b/hosts/vps/services/website.nix @@ -52,6 +52,7 @@
             fm.tzlil.net music
             git.tzlil.net for everything im too embarrased to put on sourcehut
+            arXiv randomizer
             
''} / file_server -- cgit 1.4.1