summary refs log tree commit diff
path: root/hosts/vps/services/hydrus.nix
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-07-30 13:19:39 +0300
committertzlil <tzlils@protonmail.com>2023-07-30 13:19:39 +0300
commitf72f22b250ecf22657ffc9e6082086377031ea8a (patch)
treece0f397e0933118b64bc58fab5463968d27fd0df /hosts/vps/services/hydrus.nix
parent22743d455ebb1f44f07b429a2b82045ca5b1d3ac (diff)
clean up a bit
Diffstat (limited to 'hosts/vps/services/hydrus.nix')
-rw-r--r--hosts/vps/services/hydrus.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/hosts/vps/services/hydrus.nix b/hosts/vps/services/hydrus.nix
new file mode 100644
index 0000000..c967fbc
--- /dev/null
+++ b/hosts/vps/services/hydrus.nix
@@ -0,0 +1,60 @@
+{
+  pkgs,
+  config,
+  lib,
+  ...
+}: {
+  config = {
+    users.groups.hydrus = {};
+    users.users.hydrus = {
+      isSystemUser = true;
+      description = "hydrus";
+      group = "hydrus";
+      home = "/home/hydrus";
+    };
+
+    systemd.services.Xvnc = {
+      description = "Xvnc";
+      wantedBy = ["multi-user.target"];
+
+      serviceConfig = {
+        ExecStart = "${pkgs.turbovnc}/bin/Xvnc :30 -iglx -depth 24 -rfbwait 120000 -deferupdate 1 -localhost -verbose -securitytypes none";
+        User = "hydrus";
+        Group = "hydrus";
+        Restart = "on-failure";
+        RestartSec = "5s";
+      };
+    };
+
+    systemd.services.hydrus = {
+      description = "Hydrus";
+      wantedBy = ["multi-user.target" "Xvnc.service"];
+      wants = ["podman-hydrus-web.service"];
+
+      serviceConfig = {
+        Environment = "DISPLAY=:30";
+        ExecStart = "${pkgs.hydrus}/bin/hydrus-client -d /home/hydrus";
+        User = "hydrus";
+        Group = "hydrus";
+        Restart = "on-failure";
+        RestartSec = "5s";
+      };
+    };
+
+    security.lockKernelModules = lib.mkForce false;
+    virtualisation.oci-containers.containers.hydrus-web = {
+      ports = ["100.67.217.90:8080:80"];
+      image = "ghcr.io/floogulinc/hydrus-web:dev";
+    };
+
+    networking.firewall.allowedTCPPorts = [45869];
+
+    environment.persistence."/nix/persist".directories = [
+      {
+        directory = "/home/hydrus";
+        user = "hydrus";
+        group = "hydrus";
+      }
+    ];
+  };
+}