1
0
Fork 0
forked from fabian/nix

trivionomicon: socialpredict: initial commit

This commit is contained in:
Alejandro Soto 2026-01-30 00:42:28 -06:00
parent b802d4a2c8
commit 13ff88f7b7
6 changed files with 284 additions and 0 deletions

View file

@ -6,5 +6,6 @@ in {
athena-bccr = callPackage ./athena-bccr {};
snapborg = final.python3Packages.callPackage ./snapborg {};
socialpredict = callPackage ./socialpredict {};
spliit = callPackage ./spliit {};
}

View file

@ -0,0 +1,30 @@
From 67cf25f7cb397d37d807797b6013447b19c8f73b Mon Sep 17 00:00:00 2001
From: Alejandro Soto <alejandro@34project.org>
Date: Thu, 29 Jan 2026 23:21:21 -0600
Subject: [PATCH] Support POSTGRES_URL for overriding the PG DSN
---
backend/util/postgres.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/util/postgres.go b/util/postgres.go
index ac69932..030f516 100644
--- a/util/postgres.go
+++ b/util/postgres.go
@@ -49,8 +49,11 @@ func InitDB() {
dbPort = "5432"
}
- dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=UTC",
- dbHost, dbUser, dbPassword, dbName, dbPort)
+ dsn := os.Getenv("POSTGRES_URL")
+ if dsn == "" {
+ dsn = fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=UTC",
+ dbHost, dbUser, dbPassword, dbName, dbPort)
+ }
DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
--
2.51.2

View file

@ -0,0 +1,62 @@
{
buildGoModule,
buildNpmPackage,
fetchFromGitHub,
lib,
}: let
version = "2.1.0";
src = fetchFromGitHub {
owner = "openpredictionmarkets";
repo = "socialpredict";
tag = "v${version}";
hash = "sha256-aV6Z7vsqV8zxyB+v7hSyOm/jzGqR8YnhG+xLKSC9Qoo=";
};
meta = {
description = "Easy to Deploy Prediction Market Platform ";
homepage = "https://github.com/openpredictionmarkets/socialpredict";
license = lib.licenses.mit;
maintainers = with lib.maintainers; []; # [ _3442 ];
};
in {
backend = buildGoModule {
pname = "socialpredict-backend";
inherit src version;
patches = [
./0001-Support-POSTGRES_URL-for-overriding-the-PG-DSN.patch
];
sourceRoot = "source/backend";
vendorHash = "sha256-ah2d+gHe7HULEsqMSUwGOL4D00aY0QtZvcD3pTQp/Q0=";
meta = meta // {mainProgram = "socialpredict";};
};
frontend = buildNpmPackage {
pname = "socialpredict-frontend";
inherit src meta version;
sourceRoot = "source/frontend";
npmDepsHash = "sha256-zn1yPtvi8DaKESMGAtqnh/66xET+QaCa1TUlpbatI70=";
buildPhase = ''
runHook preBuild
node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -r build/* $out
rm $out/env-config.js.template
runHook postInstall
'';
};
}