Move jinx to system and assign postgres database

We wanted an easy way to view the jinx logs and to avoid using a
separate user account which is more complicated to operate, and has more
challenges in deployment, than a normal systemd service

Change-Id: I436247a14925316ec3dcd77fb18875dc35c69560
Reviewed-on: https://git.clicks.codes/c/Infra/NixFiles/+/398
Tested-by: Skyler Grey <minion@clicks.codes>
Reviewed-by: Samuel Shuert <coded@clicks.codes>
diff --git a/modules/common/jinx.nix b/modules/common/jinx.nix
new file mode 100644
index 0000000..33f8a49
--- /dev/null
+++ b/modules/common/jinx.nix
@@ -0,0 +1,16 @@
+{ config, pkgs, lib, ... }: {
+  systemd.services.jinx = { # running for Pinea
+    serviceConfig = {
+      User = "jinx";
+      ExecStart = "${pkgs.nix}/bin/nix develop --command pnpm start";
+      WorkingDirectory = "/services/jinx/Jinx";
+      LoadCredential = "postgres_password:${config.sops.secrets.clicks_jinx_db_password.path}";
+      Environment = [
+        "PATH=${pkgs.git}/bin"
+        "DATABASE_PASSWORD_FILE=%d/postgres_password"
+      ];
+    };
+    wantedBy = [ "default.target" ];
+    description = "Run Jinx";
+  };
+}