{ pkgs, inputs, ... }: 
{
  imports = [ inputs.arion.nixosModules.arion ];
  virtualisation.docker.enable = true;
  virtualisation.arion = {
    backend = "docker";
    projects.calckey.settings = {
      networks.calcnet.name = "calcnet";
      services = {
        "web".service = {
          image = "docker.io/thatonecalculator/calckey";
          container_name = "calckey_web";
          restart = "unless-stopped";
          depends_on = [ "db" "redis" ];
          ports = [ "3000:3000" ];
          networks = [ "calcnet" ];
          environment = { 
            "NODE_ENV" = "production"; 
          };
          volumes = [
            "/calckey/files:/calckey/files"
            "/calckey/config:/calckey/.config:ro"
          ];
        };
        "redis".service = {
          image = "docker.io/redis:7.0-alpine";
          container_name = "calckey_redis";
          restart = "unless-stopped";
          networks = [ "calcnet" ];
          volumes = [ "/calckey/redis:/data" ];
        };
        "db".service = {
          image = "docker.io/postgres:12.2-alpine";
          container_name = "calckey_db";
          restart = "unless-stopped";
          networks = [ "calcnet" ];
          environment = {
            POSTGRES_PASSWORD = "calckey";
            POSTGRES_USER = "calckey";
            POSTGRES_DB = "calckey";
          };
          volumes = [
            "/calckey/db:/var/lib/postgresql/data"
          ];
        };
      };
    };
  };
}
