From 9683488ef9906de96729a80f270ba2cce25d01ab Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Wed, 22 Oct 2025 03:32:56 +0000 Subject: [PATCH] Add initial draft of twenty-crm Not sure if any of it works, this is a checkpoint to debug other things. --- modules/system/default.nix | 1 + modules/system/twenty-crm.nix | 58 +++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 modules/system/twenty-crm.nix diff --git a/modules/system/default.nix b/modules/system/default.nix index cb2cf7d..2d63d1a 100644 --- a/modules/system/default.nix +++ b/modules/system/default.nix @@ -25,6 +25,7 @@ ./synapse.nix ./timecardbot.nix ./tmux.nix + ./twenty-crm.nix ./vikunja.nix ]; } diff --git a/modules/system/twenty-crm.nix b/modules/system/twenty-crm.nix new file mode 100644 index 0000000..393b331 --- /dev/null +++ b/modules/system/twenty-crm.nix @@ -0,0 +1,58 @@ +{ pkgs, lib, config, ... }: +with lib; +let + tag = "v1.8.2"; + port = "10090"; +in { + options.myModules.twenty-crm.enable = mkEnableOption "custom twenty-crm configuration"; + + config = mkIf config.myModules.twenty-crm.enable { + services.caddy.virtualHosts."crm.gleipnir.technology".extraConfig = '' + reverse_proxy http://localhost:${port} + ''; + services.postgresql = { + ensureDatabases = [ "twenty_crm" ]; + ensureUsers = [{ + ensureClauses.login = true; + ensureDBOwnership = true; + name = "twenty_crm"; + }]; + }; + sops.secrets.twenty-crm-env = { + format = "dotenv"; + group = "twenty-crm"; + mode = "0440"; + owner = "twenty-crm"; + restartUnits = ["podman-twenty-crm.service"]; + sopsFile = ../../secrets/twenty-crm.env; + }; + users.groups.twenty-crm = {}; + users.users.twenty-crm = { + group = "twenty-crm"; + isSystemUser = true; + }; + virtualisation.oci-containers.containers.twenty-crm-webserver = { + environmentFiles = [ + "/var/run/secrets/twenty-crm-env" + ]; + image = "docker.io/twentycrm/twenty:${tag}"; + ports = [ "127.0.0.1:3000:${port}" ]; + volumes = [ + "/run/postgresql/.s.PGSQL.5432:/run/postgresql/.s.PGSQL.5432" + "twenty-crm-data:/app/packages/twenty-server/.local-storage" + ]; + }; + virtualisation.oci-containers.containers.twenty-crm-worker = { + entrypoint = "yarn worker:prod"; + environmentFiles = [ + "/var/run/secrets/twenty-crm-env" + ]; + image = "docker.io/twentycrm/twenty:${tag}"; + ports = [ "127.0.0.1:3000:${port}" ]; + volumes = [ + "/run/postgresql/.s.PGSQL.5432:/run/postgresql/.s.PGSQL.5432" + "twenty-crm-data:/app/packages/twenty-server/.local-storage" + ]; + }; + }; +}