@@ -0,0 +1,80 @@
1+{ stdenv, fetchgit, fetchNodeModules, buildPythonPackage
2+, pgpy, flask, bleach, misaka, humanize, markdown, psycopg2, pygments, requests
3+, sqlalchemy, flask_login, beautifulsoup4, sqlalchemy-utils, celery, alembic
4+, sassc, nodejs-11_x
5+, writeText }:
6+
7+buildPythonPackage rec {
8+ pname = "srht";
9+ version = "0.52.13";
10+
11+ src = fetchgit {
12+ url = "https://git.sr.ht/~sircmpwn/core.sr.ht";
13+ rev = version;
14+ sha256 = "0i7gd2rkq4y4lffxsgb3mql9ddmk3vqckan29w266imrqs6p8c0z";
15+ };
16+
17+ node_modules = fetchNodeModules {
18+ src = "${src}/srht";
19+ nodejs = nodejs-11_x;
20+ sha256 = "0axl50swhcw8llq8z2icwr4nkr5qsw2riih0a040f9wx4xiw4p6p";
21+ };
22+
23+ patches = [
24+ ./disable-npm-install.patch
25+ ];
26+
27+ nativeBuildInputs = [
28+ sassc
29+ nodejs-11_x
30+ ];
31+
32+ propagatedBuildInputs = [
33+ pgpy
34+ flask
35+ bleach
36+ misaka
37+ humanize
38+ markdown
39+ psycopg2
40+ pygments
41+ requests
42+ sqlalchemy
43+ flask_login
44+ beautifulsoup4
45+ sqlalchemy-utils
46+
47+ # Unofficial runtime dependencies?
48+ celery
49+ alembic
50+ ];
51+
52+ PKGVER = version;
53+
54+ preBuild = ''
55+ cp -r ${node_modules} srht/node_modules
56+ '';
57+
58+ # No actual? tests but seems like it needs this anyway
59+ preCheck = let
60+ config = writeText "config.ini" ''
61+ [webhooks]
62+ private-key=K6JupPpnr0HnBjelKTQUSm3Ro9SgzEA2T2Zv472OvzI=
63+
64+ [meta.sr.ht]
65+ origin=http://meta.sr.ht.local
66+ '';
67+ in ''
68+ # Validation needs config option(s)
69+ # webhooks <- ( private-key )
70+ # meta.sr.ht <- ( origin )
71+ cp ${config} config.ini
72+ '';
73+
74+ meta = with stdenv.lib; {
75+ homepage = https://git.sr.ht/~sircmpwn/srht;
76+ description = "Core modules for sr.ht";
77+ license = licenses.bsd3;
78+ maintainers = with maintainers; [ eadwu ];
79+ };
80+}