Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54425 from eadwu/init/srhtPackages
sourcehut: init
- Loading branch information
Showing
26 changed files
with
1,045 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ stdenv, fetchgit, buildPythonPackage | ||
, python | ||
, buildGoModule | ||
, srht, redis, celery, pyyaml, markdown }: | ||
|
||
let | ||
version = "0.45.13"; | ||
|
||
buildWorker = src: buildGoModule { | ||
inherit src version; | ||
pname = "builds-sr-ht-worker"; | ||
goPackagePath = "git.sr.ht/~sircmpwn/builds.sr.ht/worker"; | ||
|
||
modSha256 = "1jm259ncw8dgqp0fqbjn30c4y3v3vwqj41gfh99jx30bwlmpgfax"; | ||
}; | ||
in buildPythonPackage rec { | ||
inherit version; | ||
pname = "buildsrht"; | ||
|
||
src = fetchgit { | ||
url = "https://git.sr.ht/~sircmpwn/builds.sr.ht"; | ||
rev = version; | ||
sha256 = "002pcj2a98gbmv77a10449w1q6iqhqjz4fim8hm4qm7vn6bwp0hz"; | ||
}; | ||
|
||
patches = [ | ||
./use-srht-path.patch | ||
]; | ||
|
||
nativeBuildInputs = srht.nativeBuildInputs; | ||
|
||
propagatedBuildInputs = [ | ||
srht | ||
redis | ||
celery | ||
pyyaml | ||
markdown | ||
]; | ||
|
||
preBuild = '' | ||
export PKGVER=${version} | ||
export SRHT_PATH=${srht}/${python.sitePackages}/srht | ||
''; | ||
|
||
postInstall = '' | ||
mkdir -p $out/lib | ||
mkdir -p $out/bin/builds.sr.ht | ||
cp -r images $out/lib | ||
cp contrib/submit_image_build $out/bin/builds.sr.ht | ||
cp ${buildWorker "${src}/worker"}/bin/worker $out/bin/builds.sr.ht-worker | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://git.sr.ht/~sircmpwn/builds.sr.ht; | ||
description = "Continuous integration service for the sr.ht network"; | ||
license = licenses.agpl3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ stdenv, fetchgit, fetchNodeModules, buildPythonPackage | ||
, pgpy, flask, bleach, misaka, humanize, markdown, psycopg2, pygments, requests | ||
, sqlalchemy, flask_login, beautifulsoup4, sqlalchemy-utils, celery, alembic | ||
, sassc, nodejs-11_x | ||
, writeText }: | ||
|
||
buildPythonPackage rec { | ||
pname = "srht"; | ||
version = "0.52.13"; | ||
|
||
src = fetchgit { | ||
url = "https://git.sr.ht/~sircmpwn/core.sr.ht"; | ||
rev = version; | ||
sha256 = "0i7gd2rkq4y4lffxsgb3mql9ddmk3vqckan29w266imrqs6p8c0z"; | ||
}; | ||
|
||
node_modules = fetchNodeModules { | ||
src = "${src}/srht"; | ||
nodejs = nodejs-11_x; | ||
sha256 = "0axl50swhcw8llq8z2icwr4nkr5qsw2riih0a040f9wx4xiw4p6p"; | ||
}; | ||
|
||
patches = [ | ||
./disable-npm-install.patch | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
sassc | ||
nodejs-11_x | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
pgpy | ||
flask | ||
bleach | ||
misaka | ||
humanize | ||
markdown | ||
psycopg2 | ||
pygments | ||
requests | ||
sqlalchemy | ||
flask_login | ||
beautifulsoup4 | ||
sqlalchemy-utils | ||
|
||
# Unofficial runtime dependencies? | ||
celery | ||
alembic | ||
]; | ||
|
||
PKGVER = version; | ||
|
||
preBuild = '' | ||
cp -r ${node_modules} srht/node_modules | ||
''; | ||
|
||
# No actual? tests but seems like it needs this anyway | ||
preCheck = let | ||
config = writeText "config.ini" '' | ||
[webhooks] | ||
private-key=K6JupPpnr0HnBjelKTQUSm3Ro9SgzEA2T2Zv472OvzI= | ||
[meta.sr.ht] | ||
origin=http://meta.sr.ht.local | ||
''; | ||
in '' | ||
# Validation needs config option(s) | ||
# webhooks <- ( private-key ) | ||
# meta.sr.ht <- ( origin ) | ||
cp ${config} config.ini | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://git.sr.ht/~sircmpwn/srht; | ||
description = "Core modules for sr.ht"; | ||
license = licenses.bsd3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
49 changes: 49 additions & 0 deletions
49
pkgs/applications/version-management/sourcehut/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ python37, openssl_1_1 | ||
, callPackage }: | ||
|
||
# To expose the *srht modules, they have to be a python module so we use `buildPythonModule` | ||
# Then we expose them through all-packages.nix as an application through `toPythonApplication` | ||
# https://github.com/NixOS/nixpkgs/pull/54425#discussion_r250688781 | ||
|
||
let | ||
fetchNodeModules = callPackage ../../networking/instant-messengers/rambox/fetchNodeModules.nix { }; | ||
|
||
python = python37.override { | ||
packageOverrides = self: super: { | ||
srht = self.callPackage ./core.nix { inherit fetchNodeModules; }; | ||
|
||
buildsrht = self.callPackage ./builds.nix { }; | ||
dispatchsrht = self.callPackage ./dispatch.nix { }; | ||
gitsrht = self.callPackage ./git.nix { }; | ||
hgsrht = self.callPackage ./hg.nix { }; | ||
listssrht = self.callPackage ./lists.nix { }; | ||
mansrht = self.callPackage ./man.nix { }; | ||
metasrht = self.callPackage ./meta.nix { }; | ||
pastesrht = self.callPackage ./paste.nix { }; | ||
todosrht = self.callPackage ./todo.nix { }; | ||
|
||
scmsrht = self.callPackage ./scm.nix { }; | ||
|
||
# OVERRIDES | ||
|
||
cryptography = super.cryptography.override { | ||
openssl = openssl_1_1; | ||
}; | ||
|
||
pyopenssl = super.pyopenssl.override { | ||
openssl = openssl_1_1; | ||
}; | ||
}; | ||
}; | ||
in with python.pkgs; { | ||
inherit python; | ||
buildsrht = toPythonApplication buildsrht; | ||
dispatchsrht = toPythonApplication dispatchsrht; | ||
gitsrht = toPythonApplication gitsrht; | ||
hgsrht = toPythonApplication hgsrht; | ||
listssrht = toPythonApplication listssrht; | ||
mansrht = toPythonApplication mansrht; | ||
metasrht = toPythonApplication metasrht; | ||
pastesrht = toPythonApplication pastesrht; | ||
todosrht = toPythonApplication todosrht; | ||
} |
14 changes: 14 additions & 0 deletions
14
pkgs/applications/version-management/sourcehut/disable-npm-install.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/setup.py b/setup.py | ||
index d63bac8..e1d0c35 100755 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -5,9 +5,6 @@ import glob | ||
import os | ||
import sys | ||
|
||
-if subprocess.call(["npm", "i"], cwd="srht") != 0: | ||
- sys.exit(1) | ||
- | ||
ver = os.environ.get("PKGVER") or subprocess.run(['git', 'describe', '--tags'], | ||
stdout=subprocess.PIPE).stdout.decode().strip() | ||
|
39 changes: 39 additions & 0 deletions
39
pkgs/applications/version-management/sourcehut/dispatch.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ stdenv, fetchgit, buildPythonPackage | ||
, python | ||
, srht, pyyaml, PyGithub, cryptography }: | ||
|
||
buildPythonPackage rec { | ||
pname = "dispatchsrht"; | ||
version = "0.11.0"; | ||
|
||
src = fetchgit { | ||
url = "https://git.sr.ht/~sircmpwn/dispatch.sr.ht"; | ||
rev = version; | ||
sha256 = "1kahl2gy5a5li79djwkzkglkw2s7pl4d29bzqp8c53r0xvx4sqkz"; | ||
}; | ||
|
||
patches = [ | ||
./use-srht-path.patch | ||
]; | ||
|
||
nativeBuildInputs = srht.nativeBuildInputs; | ||
|
||
propagatedBuildInputs = [ | ||
srht | ||
pyyaml | ||
PyGithub | ||
cryptography | ||
]; | ||
|
||
preBuild = '' | ||
export PKGVER=${version} | ||
export SRHT_PATH=${srht}/${python.sitePackages}/srht | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://dispatch.sr.ht/~sircmpwn/dispatch.sr.ht; | ||
description = "Task dispatcher and service integration tool for the sr.ht network"; | ||
license = licenses.agpl3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ stdenv, fetchgit, buildPythonPackage | ||
, python | ||
, buildGoModule | ||
, srht, pygit2, scmsrht }: | ||
|
||
let | ||
version = "0.32.3"; | ||
|
||
buildDispatcher = src: buildGoModule { | ||
inherit src version; | ||
pname = "git-sr-ht-dispatcher"; | ||
goPackagePath = "git.sr.ht/~sircmpwn/git.sr.ht/gitsrht-dispatch"; | ||
|
||
modSha256 = "1lmgmlin460g09dph2hw6yz25d4agqwjhrjv0qqsis7df9qpf3i1"; | ||
}; | ||
in buildPythonPackage rec { | ||
inherit version; | ||
pname = "gitsrht"; | ||
|
||
src = fetchgit { | ||
url = "https://git.sr.ht/~sircmpwn/git.sr.ht"; | ||
rev = version; | ||
sha256 = "0grycmblhm9dnhcf1kcmn6bclgb9znahk2026dan58m9j9pja5vw"; | ||
}; | ||
|
||
patches = [ | ||
./use-srht-path.patch | ||
]; | ||
|
||
nativeBuildInputs = srht.nativeBuildInputs; | ||
|
||
propagatedBuildInputs = [ | ||
srht | ||
pygit2 | ||
scmsrht | ||
]; | ||
|
||
preBuild = '' | ||
export PKGVER=${version} | ||
export SRHT_PATH=${srht}/${python.sitePackages}/srht | ||
''; | ||
|
||
# TODO: Remove redundant mkdir? | ||
postInstall = '' | ||
mkdir -p $out/bin | ||
cp ${buildDispatcher "${src}/gitsrht-dispatch"}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://git.sr.ht/~sircmpwn/git.sr.ht; | ||
description = "Git repository hosting service for the sr.ht network"; | ||
license = licenses.agpl3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ stdenv, fetchhg, buildPythonPackage | ||
, python | ||
, srht, hglib, scmsrht, unidiff }: | ||
|
||
buildPythonPackage rec { | ||
pname = "hgsrht"; | ||
version = "0.13.0"; | ||
|
||
src = fetchhg { | ||
url = "https://hg.sr.ht/~sircmpwn/hg.sr.ht"; | ||
rev = version; | ||
sha256 = "0qkknvja0pyk69fvzqafj3x8hi5miw22nmksvifbrjcqph8jknqg"; | ||
}; | ||
|
||
patches = [ | ||
./use-srht-path.patch | ||
]; | ||
|
||
nativeBuildInputs = srht.nativeBuildInputs; | ||
|
||
propagatedBuildInputs = [ | ||
srht | ||
hglib | ||
scmsrht | ||
unidiff | ||
]; | ||
|
||
preBuild = '' | ||
export PKGVER=${version} | ||
export SRHT_PATH=${srht}/${python.sitePackages}/srht | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://git.sr.ht/~sircmpwn/hg.sr.ht; | ||
description = "Mercurial repository hosting service for the sr.ht network"; | ||
license = licenses.agpl3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ stdenv, fetchgit, buildPythonPackage | ||
, python | ||
, srht, asyncpg, unidiff, aiosmtpd, emailthreads }: | ||
|
||
buildPythonPackage rec { | ||
pname = "listssrht"; | ||
version = "0.36.3"; | ||
|
||
src = fetchgit { | ||
url = "https://git.sr.ht/~sircmpwn/lists.sr.ht"; | ||
rev = version; | ||
sha256 = "1q2z2pjwz4zifsrkxab9b9jh1vzayjqych1cx3i4859f1swl2gwa"; | ||
}; | ||
|
||
patches = [ | ||
./use-srht-path.patch | ||
]; | ||
|
||
nativeBuildInputs = srht.nativeBuildInputs; | ||
|
||
propagatedBuildInputs = [ | ||
srht | ||
asyncpg | ||
unidiff | ||
aiosmtpd | ||
emailthreads | ||
]; | ||
|
||
preBuild = '' | ||
export PKGVER=${version} | ||
export SRHT_PATH=${srht}/${python.sitePackages}/srht | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
homepage = https://git.sr.ht/~sircmpwn/lists.sr.ht; | ||
description = "Mailing list service for the sr.ht network"; | ||
license = licenses.agpl3; | ||
maintainers = with maintainers; [ eadwu ]; | ||
}; | ||
} |
Oops, something went wrong.