summary refs log tree commit diff
path: root/hosts/vps
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-09-09 01:47:07 +0300
committertzlil <tzlils@protonmail.com>2023-09-09 01:48:16 +0300
commitb8d9878cea5a65e2e6ab4b98aace676f34038824 (patch)
tree97b54439395f9c9eea0f9940ba6285ca836252e5 /hosts/vps
parent387836d53360039514bfa11014e48687dd82ed2d (diff)
add arxiv randomizer and some other crap i forgot
Diffstat (limited to 'hosts/vps')
-rw-r--r--hosts/vps/default.nix1
-rw-r--r--hosts/vps/services/arXiv.nix41
-rw-r--r--hosts/vps/services/website.nix1
3 files changed, 43 insertions, 0 deletions
diff --git a/hosts/vps/default.nix b/hosts/vps/default.nix
index cfa50c7..7cd5f6c 100644
--- a/hosts/vps/default.nix
+++ b/hosts/vps/default.nix
@@ -13,6 +13,7 @@
     ./services/hydrus.nix
     ./services/matrix.nix
     ./services/maloja.nix
+    ./services/arXiv.nix
   ];
 
   config = {
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 @@
              <pre>
             <a href="https://fm.tzlil.net">fm.tzlil.net</a> music
             <a href="https://git.tzlil.net">git.tzlil.net</a> for everything im too embarrased to put on sourcehut
+            <a href="/arXiv">arXiv randomizer</a>
             </pre>
           ''} /
             file_server