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/default.nix | 1 + hosts/vps/services/arXiv.nix | 41 +++++++++++++++++++++++++++++++++++++++++ hosts/vps/services/website.nix | 1 + 3 files changed, 43 insertions(+) create mode 100644 hosts/vps/services/arXiv.nix (limited to 'hosts/vps') 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 @@
             fm.tzlil.net music
             git.tzlil.net for everything im too embarrased to put on sourcehut
+            arXiv randomizer
             
''} / file_server -- cgit 1.4.1