git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #54425 from eadwu/init/srhtPackages

sourcehut: init

commit8f156698bf1ce6de300be90c2239a140ca43e523 authorJoachim F <joachifm@users.noreply.github.com> dateWed 14 Aug 2019, 14:50 (7 years ago) parent6bb07c8a2ca6ef
26 files changed+1045
pkgs/applications/version-management/sourcehut/builds.nix+60 pkgs/applications/version-management/sourcehut/core.nix+80 pkgs/applications/version-management/sourcehut/default.nix+49 pkgs/applications/version-management/sourcehut/disable-npm-install.patch+14 pkgs/applications/version-management/sourcehut/dispatch.nix+39 pkgs/applications/version-management/sourcehut/git.nix+55 pkgs/applications/version-management/sourcehut/hg.nix+39 pkgs/applications/version-management/sourcehut/lists.nix+40 pkgs/applications/version-management/sourcehut/man.nix+37 pkgs/applications/version-management/sourcehut/meta.nix+48 pkgs/applications/version-management/sourcehut/paste.nix+37 pkgs/applications/version-management/sourcehut/scm.nix+55 pkgs/applications/version-management/sourcehut/todo.nix+42 pkgs/applications/version-management/sourcehut/update.sh+54 pkgs/applications/version-management/sourcehut/use-srht-path.patch+43 pkgs/development/python-modules/aiosmtpd/default.nix+32 pkgs/development/python-modules/asyncpg/default.nix+38 pkgs/development/python-modules/atpublic/default.nix+38 pkgs/development/python-modules/emailthreads/default.nix+29 pkgs/development/python-modules/flake8-polyfill/default.nix+40 pkgs/development/python-modules/pep8-naming/default.nix+23 pkgs/development/python-modules/pgpy/default.nix+48 pkgs/development/python-modules/pytest-ordering/default.nix+31 pkgs/development/python-modules/sqlalchemy-utils/default.nix+50 pkgs/top-level/all-packages.nix+2 pkgs/top-level/python-packages.nix+22
pkgs/applications/version-management/sourcehut/builds.nixnew file+60
@@ -0,0 +1,60 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, buildGoModule
4+, srht, redis, celery, pyyaml, markdown }:
5+
6+let
7+ version = "0.45.13";
8+
9+ buildWorker = src: buildGoModule {
10+ inherit src version;
11+ pname = "builds-sr-ht-worker";
12+ goPackagePath = "git.sr.ht/~sircmpwn/builds.sr.ht/worker";
13+
14+ modSha256 = "1jm259ncw8dgqp0fqbjn30c4y3v3vwqj41gfh99jx30bwlmpgfax";
15+ };
16+in buildPythonPackage rec {
17+ inherit version;
18+ pname = "buildsrht";
19+
20+ src = fetchgit {
21+ url = "https://git.sr.ht/~sircmpwn/builds.sr.ht";
22+ rev = version;
23+ sha256 = "002pcj2a98gbmv77a10449w1q6iqhqjz4fim8hm4qm7vn6bwp0hz";
24+ };
25+
26+ patches = [
27+ ./use-srht-path.patch
28+ ];
29+
30+ nativeBuildInputs = srht.nativeBuildInputs;
31+
32+ propagatedBuildInputs = [
33+ srht
34+ redis
35+ celery
36+ pyyaml
37+ markdown
38+ ];
39+
40+ preBuild = ''
41+ export PKGVER=${version}
42+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
43+ '';
44+
45+ postInstall = ''
46+ mkdir -p $out/lib
47+ mkdir -p $out/bin/builds.sr.ht
48+
49+ cp -r images $out/lib
50+ cp contrib/submit_image_build $out/bin/builds.sr.ht
51+ cp ${buildWorker "${src}/worker"}/bin/worker $out/bin/builds.sr.ht-worker
52+ '';
53+
54+ meta = with stdenv.lib; {
55+ homepage = https://git.sr.ht/~sircmpwn/builds.sr.ht;
56+ description = "Continuous integration service for the sr.ht network";
57+ license = licenses.agpl3;
58+ maintainers = with maintainers; [ eadwu ];
59+ };
60+}
pkgs/applications/version-management/sourcehut/core.nixnew file+80
@@ -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+}
pkgs/applications/version-management/sourcehut/default.nixnew file+49
@@ -0,0 +1,49 @@
1+{ python37, openssl_1_1
2+, callPackage }:
3+
4+# To expose the *srht modules, they have to be a python module so we use `buildPythonModule`
5+# Then we expose them through all-packages.nix as an application through `toPythonApplication`
6+# https://github.com/NixOS/nixpkgs/pull/54425#discussion_r250688781
7+
8+let
9+ fetchNodeModules = callPackage ../../networking/instant-messengers/rambox/fetchNodeModules.nix { };
10+
11+ python = python37.override {
12+ packageOverrides = self: super: {
13+ srht = self.callPackage ./core.nix { inherit fetchNodeModules; };
14+
15+ buildsrht = self.callPackage ./builds.nix { };
16+ dispatchsrht = self.callPackage ./dispatch.nix { };
17+ gitsrht = self.callPackage ./git.nix { };
18+ hgsrht = self.callPackage ./hg.nix { };
19+ listssrht = self.callPackage ./lists.nix { };
20+ mansrht = self.callPackage ./man.nix { };
21+ metasrht = self.callPackage ./meta.nix { };
22+ pastesrht = self.callPackage ./paste.nix { };
23+ todosrht = self.callPackage ./todo.nix { };
24+
25+ scmsrht = self.callPackage ./scm.nix { };
26+
27+ # OVERRIDES
28+
29+ cryptography = super.cryptography.override {
30+ openssl = openssl_1_1;
31+ };
32+
33+ pyopenssl = super.pyopenssl.override {
34+ openssl = openssl_1_1;
35+ };
36+ };
37+ };
38+in with python.pkgs; {
39+ inherit python;
40+ buildsrht = toPythonApplication buildsrht;
41+ dispatchsrht = toPythonApplication dispatchsrht;
42+ gitsrht = toPythonApplication gitsrht;
43+ hgsrht = toPythonApplication hgsrht;
44+ listssrht = toPythonApplication listssrht;
45+ mansrht = toPythonApplication mansrht;
46+ metasrht = toPythonApplication metasrht;
47+ pastesrht = toPythonApplication pastesrht;
48+ todosrht = toPythonApplication todosrht;
49+}
pkgs/applications/version-management/sourcehut/disable-npm-install.patchnew file+14
@@ -0,0 +1,14 @@
1+diff --git a/setup.py b/setup.py
2+index d63bac8..e1d0c35 100755
3+--- a/setup.py
4++++ b/setup.py
5+@@ -5,9 +5,6 @@ import glob
6+ import os
7+ import sys
8+
9+-if subprocess.call(["npm", "i"], cwd="srht") != 0:
10+- sys.exit(1)
11+-
12+ ver = os.environ.get("PKGVER") or subprocess.run(['git', 'describe', '--tags'],
13+ stdout=subprocess.PIPE).stdout.decode().strip()
14+
pkgs/applications/version-management/sourcehut/dispatch.nixnew file+39
@@ -0,0 +1,39 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, srht, pyyaml, PyGithub, cryptography }:
4+
5+buildPythonPackage rec {
6+ pname = "dispatchsrht";
7+ version = "0.11.0";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/dispatch.sr.ht";
11+ rev = version;
12+ sha256 = "1kahl2gy5a5li79djwkzkglkw2s7pl4d29bzqp8c53r0xvx4sqkz";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ pyyaml
24+ PyGithub
25+ cryptography
26+ ];
27+
28+ preBuild = ''
29+ export PKGVER=${version}
30+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
31+ '';
32+
33+ meta = with stdenv.lib; {
34+ homepage = https://dispatch.sr.ht/~sircmpwn/dispatch.sr.ht;
35+ description = "Task dispatcher and service integration tool for the sr.ht network";
36+ license = licenses.agpl3;
37+ maintainers = with maintainers; [ eadwu ];
38+ };
39+}
pkgs/applications/version-management/sourcehut/git.nixnew file+55
@@ -0,0 +1,55 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, buildGoModule
4+, srht, pygit2, scmsrht }:
5+
6+let
7+ version = "0.32.3";
8+
9+ buildDispatcher = src: buildGoModule {
10+ inherit src version;
11+ pname = "git-sr-ht-dispatcher";
12+ goPackagePath = "git.sr.ht/~sircmpwn/git.sr.ht/gitsrht-dispatch";
13+
14+ modSha256 = "1lmgmlin460g09dph2hw6yz25d4agqwjhrjv0qqsis7df9qpf3i1";
15+ };
16+in buildPythonPackage rec {
17+ inherit version;
18+ pname = "gitsrht";
19+
20+ src = fetchgit {
21+ url = "https://git.sr.ht/~sircmpwn/git.sr.ht";
22+ rev = version;
23+ sha256 = "0grycmblhm9dnhcf1kcmn6bclgb9znahk2026dan58m9j9pja5vw";
24+ };
25+
26+ patches = [
27+ ./use-srht-path.patch
28+ ];
29+
30+ nativeBuildInputs = srht.nativeBuildInputs;
31+
32+ propagatedBuildInputs = [
33+ srht
34+ pygit2
35+ scmsrht
36+ ];
37+
38+ preBuild = ''
39+ export PKGVER=${version}
40+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
41+ '';
42+
43+ # TODO: Remove redundant mkdir?
44+ postInstall = ''
45+ mkdir -p $out/bin
46+ cp ${buildDispatcher "${src}/gitsrht-dispatch"}/bin/gitsrht-dispatch $out/bin/gitsrht-dispatch
47+ '';
48+
49+ meta = with stdenv.lib; {
50+ homepage = https://git.sr.ht/~sircmpwn/git.sr.ht;
51+ description = "Git repository hosting service for the sr.ht network";
52+ license = licenses.agpl3;
53+ maintainers = with maintainers; [ eadwu ];
54+ };
55+}
pkgs/applications/version-management/sourcehut/hg.nixnew file+39
@@ -0,0 +1,39 @@
1+{ stdenv, fetchhg, buildPythonPackage
2+, python
3+, srht, hglib, scmsrht, unidiff }:
4+
5+buildPythonPackage rec {
6+ pname = "hgsrht";
7+ version = "0.13.0";
8+
9+ src = fetchhg {
10+ url = "https://hg.sr.ht/~sircmpwn/hg.sr.ht";
11+ rev = version;
12+ sha256 = "0qkknvja0pyk69fvzqafj3x8hi5miw22nmksvifbrjcqph8jknqg";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ hglib
24+ scmsrht
25+ unidiff
26+ ];
27+
28+ preBuild = ''
29+ export PKGVER=${version}
30+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
31+ '';
32+
33+ meta = with stdenv.lib; {
34+ homepage = https://git.sr.ht/~sircmpwn/hg.sr.ht;
35+ description = "Mercurial repository hosting service for the sr.ht network";
36+ license = licenses.agpl3;
37+ maintainers = with maintainers; [ eadwu ];
38+ };
39+}
pkgs/applications/version-management/sourcehut/lists.nixnew file+40
@@ -0,0 +1,40 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, srht, asyncpg, unidiff, aiosmtpd, emailthreads }:
4+
5+buildPythonPackage rec {
6+ pname = "listssrht";
7+ version = "0.36.3";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/lists.sr.ht";
11+ rev = version;
12+ sha256 = "1q2z2pjwz4zifsrkxab9b9jh1vzayjqych1cx3i4859f1swl2gwa";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ asyncpg
24+ unidiff
25+ aiosmtpd
26+ emailthreads
27+ ];
28+
29+ preBuild = ''
30+ export PKGVER=${version}
31+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
32+ '';
33+
34+ meta = with stdenv.lib; {
35+ homepage = https://git.sr.ht/~sircmpwn/lists.sr.ht;
36+ description = "Mailing list service for the sr.ht network";
37+ license = licenses.agpl3;
38+ maintainers = with maintainers; [ eadwu ];
39+ };
40+}
pkgs/applications/version-management/sourcehut/man.nixnew file+37
@@ -0,0 +1,37 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, srht, pygit2 }:
4+
5+buildPythonPackage rec {
6+ pname = "mansrht";
7+ version = "0.12.4";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/man.sr.ht";
11+ rev = version;
12+ sha256 = "1csnw71yh5zw7l17xmmxyskwiqbls0ynbbjrg45y5k1i3622mhiy";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ pygit2
24+ ];
25+
26+ preBuild = ''
27+ export PKGVER=${version}
28+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
29+ '';
30+
31+ meta = with stdenv.lib; {
32+ homepage = https://git.sr.ht/~sircmpwn/man.sr.ht;
33+ description = "Wiki service for the sr.ht network";
34+ license = licenses.agpl3;
35+ maintainers = with maintainers; [ eadwu ];
36+ };
37+}
pkgs/applications/version-management/sourcehut/meta.nixnew file+48
@@ -0,0 +1,48 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, pgpy, srht, redis, bcrypt, qrcode, stripe, zxcvbn, alembic, pystache
4+, sshpubkeys, weasyprint, prometheus_client }:
5+
6+buildPythonPackage rec {
7+ pname = "metasrht";
8+ version = "0.34.3";
9+
10+ src = fetchgit {
11+ url = "https://git.sr.ht/~sircmpwn/meta.sr.ht";
12+ rev = version;
13+ sha256 = "1yj3npw1vlqawzj6q1mh6qryx009dg5prja9fn6rasfmxjn2gr7v";
14+ };
15+
16+ nativeBuildInputs = srht.nativeBuildInputs;
17+
18+ propagatedBuildInputs = [
19+ pgpy
20+ srht
21+ redis
22+ bcrypt
23+ qrcode
24+ stripe
25+ zxcvbn
26+ alembic
27+ pystache
28+ sshpubkeys
29+ weasyprint
30+ prometheus_client
31+ ];
32+
33+ patches = [
34+ ./use-srht-path.patch
35+ ];
36+
37+ preBuild = ''
38+ export PKGVER=${version}
39+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
40+ '';
41+
42+ meta = with stdenv.lib; {
43+ homepage = https://git.sr.ht/~sircmpwn/meta.sr.ht;
44+ description = "Account management service for the sr.ht network";
45+ license = licenses.agpl3;
46+ maintainers = with maintainers; [ eadwu ];
47+ };
48+}
pkgs/applications/version-management/sourcehut/paste.nixnew file+37
@@ -0,0 +1,37 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, srht, pyyaml }:
4+
5+buildPythonPackage rec {
6+ pname = "pastesrht";
7+ version = "0.5.1";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/paste.sr.ht";
11+ rev = version;
12+ sha256 = "0bzw03hcwi1pw16kliqjsr7kphqq3qw0pbpdjqkcs7jdr0a59vny";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ pyyaml
24+ ];
25+
26+ preBuild = ''
27+ export PKGVER=${version}
28+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
29+ '';
30+
31+ meta = with stdenv.lib; {
32+ homepage = https://git.sr.ht/~sircmpwn/paste.sr.ht;
33+ description = "Ad-hoc text file hosting service for the sr.ht network";
34+ license = licenses.agpl3;
35+ maintainers = with maintainers; [ eadwu ];
36+ };
37+}
pkgs/applications/version-management/sourcehut/scm.nixnew file+55
@@ -0,0 +1,55 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, srht, redis, pyyaml, buildsrht
3+, writeText }:
4+
5+buildPythonPackage rec {
6+ pname = "scmsrht";
7+ version = "0.13.3";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/scm.sr.ht";
11+ rev = version;
12+ sha256 = "0bapddgfqrs27y6prd6kwpz6jdlr33zdqr6ci6ixi584a7z8z7d6";
13+ };
14+
15+ nativeBuildInputs = srht.nativeBuildInputs;
16+
17+ propagatedBuildInputs = [
18+ srht
19+ redis
20+ pyyaml
21+ buildsrht
22+ ];
23+
24+ preBuild = ''
25+ export PKGVER=${version}
26+ '';
27+
28+ # No actual? tests but seems like it needs this anyway
29+ preCheck = let
30+ config = writeText "config.ini" ''
31+ [webhooks]
32+ private-key=K6JupPpnr0HnBjelKTQUSm3Ro9SgzEA2T2Zv472OvzI=
33+
34+ [builds.sr.ht]
35+ origin=http://builds.sr.ht.local
36+ oauth-client-id=
37+
38+ [meta.sr.ht]
39+ origin=http://meta.sr.ht.local
40+ '';
41+ in ''
42+ # Validation needs config option(s)
43+ # webhooks <- ( private-key )
44+ # meta.sr.ht <- ( origin )
45+ # builds.sr.ht <- ( origin, oauth-client-id )
46+ cp ${config} config.ini
47+ '';
48+
49+ meta = with stdenv.lib; {
50+ homepage = https://git.sr.ht/~sircmpwn/git.sr.ht;
51+ description = "Shared support code for sr.ht source control services.";
52+ license = licenses.agpl3;
53+ maintainers = with maintainers; [ eadwu ];
54+ };
55+}
pkgs/applications/version-management/sourcehut/todo.nixnew file+42
@@ -0,0 +1,42 @@
1+{ stdenv, fetchgit, buildPythonPackage
2+, python
3+, srht, redis, alembic, pystache }:
4+
5+buildPythonPackage rec {
6+ pname = "todosrht";
7+ version = "0.46.8";
8+
9+ src = fetchgit {
10+ url = "https://git.sr.ht/~sircmpwn/todo.sr.ht";
11+ rev = version;
12+ sha256 = "17nqqy81535jnkidjiqv8v2301w5wzbbvx4czib69aagw1l85gnn";
13+ };
14+
15+ patches = [
16+ ./use-srht-path.patch
17+ ];
18+
19+ nativeBuildInputs = srht.nativeBuildInputs;
20+
21+ propagatedBuildInputs = [
22+ srht
23+ redis
24+ alembic
25+ pystache
26+ ];
27+
28+ preBuild = ''
29+ export PKGVER=${version}
30+ export SRHT_PATH=${srht}/${python.sitePackages}/srht
31+ '';
32+
33+ # Tests require a network connection
34+ doCheck = false;
35+
36+ meta = with stdenv.lib; {
37+ homepage = https://todo.sr.ht/~sircmpwn/todo.sr.ht;
38+ description = "Ticket tracking service for the sr.ht network";
39+ license = licenses.agpl3;
40+ maintainers = with maintainers; [ eadwu ];
41+ };
42+}
pkgs/applications/version-management/sourcehut/update.shnew file+54
@@ -0,0 +1,54 @@
1+#! /usr/bin/env nix-shell
2+#! nix-shell -i bash -p git mercurial common-updater-scripts
3+
4+cd "$(dirname "${BASH_SOURCE[0]}")"
5+root=../../../..
6+
7+default() {
8+ (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
9+}
10+
11+version() {
12+ (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.version" | tr -d '"')
13+}
14+
15+src_url() {
16+ (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.src.drvAttrs.url" | tr -d '"')
17+}
18+
19+get_latest_version() {
20+ src="$(src_url "$1")"
21+ tmp=$(mktemp -d)
22+
23+ if [ "$1" = "hgsrht" ]; then
24+ hg clone "$src" "$tmp" &> /dev/null
25+ printf "%s" "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')"
26+ else
27+ git clone "$src" "$tmp"
28+ printf "%s" "$(cd "$tmp" && git describe $(git rev-list --tags --max-count=1))"
29+ fi
30+}
31+
32+update_version() {
33+ default_nix="$(default "$1")"
34+ version_old="$(version "$1")"
35+ version="$(get_latest_version "$1")"
36+
37+ (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
38+
39+ git add "$default_nix"
40+ git commit -m "$1: $version_old -> $version"
41+}
42+
43+services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "listssrht" "mansrht" "metasrht"
44+ "pastesrht" "todosrht" "scmsrht" )
45+
46+# Whether or not a specific service is requested
47+if [ -n "$1" ]; then
48+ version="$(get_latest_version "$1")"
49+ (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version")
50+else
51+ for service in "${services[@]}"; do
52+ update_version "$service"
53+ done
54+fi
pkgs/applications/version-management/sourcehut/use-srht-path.patchnew file+43
@@ -0,0 +1,43 @@
1+diff --git a/setup.py b/setup.py
2+index e6ecfb6..89fa92a 100755
3+--- a/setup.py
4++++ b/setup.py
5+@@ -5,28 +5,16 @@ import os
6+ import site
7+ import sys
8+
9+-if hasattr(site, 'getsitepackages'):
10+- pkg_dirs = site.getsitepackages()
11+- if site.getusersitepackages():
12+- pkg_dirs.append(site.getusersitepackages())
13+- for pkg_dir in pkg_dirs:
14+- srht_path = os.path.join(pkg_dir, "srht")
15+- if os.path.isdir(srht_path):
16+- break
17+- else:
18+- raise Exception("Can't find core srht module in your site packages "
19+- "directories. Please install it first.")
20+-else:
21+- srht_path = os.getenv("SRHT_PATH")
22+- if not srht_path:
23+- raise Exception("You're running inside a virtual environment. "
24+- "Due to virtualenv limitations, you need to set the "
25+- "$SRHT_PATH environment variable to the path of the "
26+- "core srht module.")
27+- elif not os.path.isdir(srht_path):
28+- raise Exception(
29+- "The $SRHT_PATH environment variable points to an invalid "
30+- "directory: {}".format(srht_path))
31++srht_path = os.getenv("SRHT_PATH")
32++if not srht_path:
33++ raise Exception("You're running inside a virtual environment. "
34++ "Due to virtualenv limitations, you need to set the "
35++ "$SRHT_PATH environment variable to the path of the "
36++ "core srht module.")
37++elif not os.path.isdir(srht_path):
38++ raise Exception(
39++ "The $SRHT_PATH environment variable points to an invalid "
40++ "directory: {}".format(srht_path))
41+
42+ subp = subprocess.run(["make", "SRHT_PATH=" + srht_path])
43+ if subp.returncode != 0:
pkgs/development/python-modules/aiosmtpd/default.nixnew file+32
@@ -0,0 +1,32 @@
1+{ lib, isPy3k, fetchPypi, buildPythonPackage
2+, atpublic }:
3+
4+buildPythonPackage rec {
5+ pname = "aiosmtpd";
6+ version = "1.2";
7+ disabled = !isPy3k;
8+
9+ src = fetchPypi {
10+ inherit pname version;
11+ sha256 = "1xdfk741pjmz1cm8dsi4n5vq4517i175rm94696m3f7kcgk7xsmp";
12+ };
13+
14+ propagatedBuildInputs = [
15+ atpublic
16+ ];
17+
18+ # Tests need network access
19+ doCheck = false;
20+
21+ meta = with lib; {
22+ homepage = https://aiosmtpd.readthedocs.io/en/latest/;
23+ description = "Asyncio based SMTP server";
24+ longDescription = ''
25+ This is a server for SMTP and related protocols, similar in utility to the
26+ standard library's smtpd.py module, but rewritten to be based on asyncio for
27+ Python 3.
28+ '';
29+ license = licenses.asl20;
30+ maintainers = with maintainers; [ eadwu ];
31+ };
32+}
pkgs/development/python-modules/asyncpg/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ lib, isPy3k, fetchPypi, fetchpatch, buildPythonPackage
2+, uvloop, postgresql }:
3+
4+buildPythonPackage rec {
5+ pname = "asyncpg";
6+ version = "0.18.3";
7+ disabled = !isPy3k;
8+
9+ src = fetchPypi {
10+ inherit pname version;
11+ sha256 = "0rrch478ww6ipmh3617sb2jzwsq4w7pjcck869p35zb0mk5fr9aq";
12+ };
13+
14+ patches = [
15+ (fetchpatch {
16+ url = "https://github.com/MagicStack/asyncpg/commit/aaeb7076e5acb045880b46155014c0640624797e.patch";
17+ sha256 = "0r6g6pvb39vzci8g67mv9rlrvavqvfz6vlv8988wv53bpz1mss3p";
18+ })
19+ ];
20+
21+ checkInputs = [
22+ uvloop
23+ postgresql
24+ ];
25+
26+ meta = with lib; {
27+ homepage = https://github.com/MagicStack/asyncpg;
28+ description = "An asyncio PosgtreSQL driver";
29+ longDescription = ''
30+ Asyncpg is a database interface library designed specifically for
31+ PostgreSQL and Python/asyncio. asyncpg is an efficient, clean
32+ implementation of PostgreSQL server binary protocol for use with Python’s
33+ asyncio framework.
34+ '';
35+ license = licenses.asl20;
36+ maintainers = with maintainers; [ eadwu ];
37+ };
38+}
pkgs/development/python-modules/atpublic/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ lib, isPy3k, fetchPypi, buildPythonPackage
2+, pytest }:
3+
4+buildPythonPackage rec {
5+ pname = "atpublic";
6+ version = "1.0";
7+ disabled = !isPy3k;
8+
9+ src = fetchPypi {
10+ inherit pname version;
11+ sha256 = "0i3sbxkdlbb4560rrlmwwd5y4ps7k73lp4d8wnmd7ag9k426gjkx";
12+ };
13+
14+ checkInputs = [
15+ pytest
16+ ];
17+
18+ checkPhase = ''
19+ pytest --pyargs public
20+ '';
21+
22+ meta = with lib; {
23+ homepage = https://public.readthedocs.io/en/latest/;
24+ description = "A decorator and function which populates a module's __all__ and globals";
25+ longDescription = ''
26+ This is a very simple decorator and function which populates a module's
27+ __all__ and optionally the module globals.
28+
29+ This provides both a pure-Python implementation and a C implementation. It is
30+ proposed that the C implementation be added to builtins_ for Python 3.6.
31+
32+ This proposal seems to have been rejected, for more information see
33+ https://bugs.python.org/issue26632.
34+ '';
35+ license = licenses.asl20;
36+ maintainers = with maintainers; [ eadwu ];
37+ };
38+}
pkgs/development/python-modules/emailthreads/default.nixnew file+29
@@ -0,0 +1,29 @@
1+{ lib, fetchFromGitHub, buildPythonPackage
2+, python, isPy3k }:
3+
4+buildPythonPackage rec {
5+ pname = "emailthreads";
6+ version = "0.1.0";
7+ disabled = !isPy3k;
8+
9+ # pypi is missing files for tests
10+ src = fetchFromGitHub {
11+ owner = "emersion";
12+ repo = "python-emailthreads";
13+ rev = "v${version}";
14+ sha256 = "17pfal8kbxhs025apkijqbkppw2lljca8x1cwcx49jv60h05c3cn";
15+ };
16+
17+ PKGVER = version;
18+
19+ checkPhase = ''
20+ ${python.interpreter} -m unittest discover test
21+ '';
22+
23+ meta = with lib; {
24+ homepage = https://github.com/emersion/python-emailthreads;
25+ description = "Python library to parse and format email threads";
26+ license = licenses.mit;
27+ maintainers = with maintainers; [ eadwu ];
28+ };
29+}
pkgs/development/python-modules/flake8-polyfill/default.nixnew file+40
@@ -0,0 +1,40 @@
1+{ lib, fetchPypi, buildPythonPackage
2+, flake8
3+, mock, pep8, pytest }:
4+
5+buildPythonPackage rec {
6+ pname = "flake8-polyfill";
7+ version = "1.0.2";
8+
9+ src = fetchPypi {
10+ inherit pname version;
11+ sha256 = "1nlf1mkqw856vi6782qcglqhaacb23khk9wkcgn55npnjxshhjz4";
12+ };
13+
14+ postPatch = ''
15+ # Failed: [pytest] section in setup.cfg files is no longer supported, change to [tool:pytest] instead.
16+ substituteInPlace setup.cfg \
17+ --replace pytest 'tool:pytest'
18+ '';
19+
20+ propagatedBuildInputs = [
21+ flake8
22+ ];
23+
24+ checkInputs = [
25+ mock
26+ pep8
27+ pytest
28+ ];
29+
30+ checkPhase = ''
31+ pytest tests
32+ '';
33+
34+ meta = with lib; {
35+ homepage = https://gitlab.com/pycqa/flake8-polyfill;
36+ description = "Polyfill package for Flake8 plugins";
37+ license = licenses.mit;
38+ maintainers = with maintainers; [ eadwu ];
39+ };
40+}
pkgs/development/python-modules/pep8-naming/default.nixnew file+23
@@ -0,0 +1,23 @@
1+{ lib, fetchPypi, buildPythonPackage
2+, flake8-polyfill }:
3+
4+buildPythonPackage rec {
5+ pname = "pep8-naming";
6+ version = "0.8.2";
7+
8+ src = fetchPypi {
9+ inherit pname version;
10+ sha256 = "1aff4g3i2z08cx7z17nbxbf32ddrnvqlk16h6d8h9s9w5ymivjq1";
11+ };
12+
13+ propagatedBuildInputs = [
14+ flake8-polyfill
15+ ];
16+
17+ meta = with lib; {
18+ homepage = https://github.com/PyCQA/pep8-naming;
19+ description = "Check PEP-8 naming conventions, plugin for flake8";
20+ license = licenses.mit;
21+ maintainers = with maintainers; [ eadwu ];
22+ };
23+}
pkgs/development/python-modules/pgpy/default.nixnew file+48
@@ -0,0 +1,48 @@
1+{ lib, isPy3k, fetchFromGitHub, buildPythonPackage
2+, six, enum34, pyasn1, cryptography, singledispatch
3+, fetchPypi
4+, gpgme, flake8, pytest, pytestcov, pep8-naming, pytest-ordering }:
5+
6+buildPythonPackage rec {
7+ pname = "pgpy";
8+ version = "0.5.2";
9+
10+ src = fetchFromGitHub {
11+ owner = "SecurityInnovation";
12+ repo = "PGPy";
13+ rev = version;
14+ sha256 = "1v2b1dyq1sl48d2gw7vn4hv6sasd9ihpzzcq8yvxj9dgfak2y663";
15+ };
16+
17+ propagatedBuildInputs = [
18+ six
19+ pyasn1
20+ cryptography
21+ singledispatch
22+ ] ++ lib.optional (!isPy3k) enum34;
23+
24+ checkInputs = [
25+ gpgme
26+ flake8
27+ pytest
28+ pytestcov
29+ pep8-naming
30+ pytest-ordering
31+ ];
32+
33+ checkPhase = ''
34+ pytest
35+ '';
36+
37+ meta = with lib; {
38+ homepage = https://github.com/SecurityInnovation/PGPy;
39+ description = "Pretty Good Privacy for Python 2 and 3";
40+ longDescription = ''
41+ PGPy is a Python (2 and 3) library for implementing Pretty Good Privacy
42+ into Python programs, conforming to the OpenPGP specification per RFC
43+ 4880.
44+ '';
45+ license = licenses.bsd3;
46+ maintainers = with maintainers; [ eadwu ];
47+ };
48+}
pkgs/development/python-modules/pytest-ordering/default.nixnew file+31
@@ -0,0 +1,31 @@
1+{ lib, fetchFromGitHub, buildPythonPackage
2+, pytest }:
3+
4+buildPythonPackage rec {
5+ pname = "pytest-ordering";
6+ version = "unstable-2019-06-19";
7+
8+ # Pypi lacks tests/
9+ # Resolves PytestUnknownMarkWarning from pytest
10+ src = fetchFromGitHub {
11+ owner = "ftobia";
12+ repo = pname;
13+ rev = "492697ee26633cc31d329c1ceaa468375ee8ee9c";
14+ sha256 = "1xim0kj5g37p1skgvp8gdylpx949krmx60w3pw6j1m1h7sakmddn";
15+ };
16+
17+ checkInputs = [
18+ pytest
19+ ];
20+
21+ checkPhase = ''
22+ pytest tests
23+ '';
24+
25+ meta = with lib; {
26+ homepage = https://github.com/ftobia/pytest-ordering;
27+ description = "Pytest plugin to run your tests in a specific order";
28+ license = licenses.mit;
29+ maintainers = with maintainers; [ eadwu ];
30+ };
31+}
pkgs/development/python-modules/sqlalchemy-utils/default.nixnew file+50
@@ -0,0 +1,50 @@
1+{ lib, fetchPypi, buildPythonPackage
2+, six, sqlalchemy
3+, mock, pytz, isort, flake8, jinja2, pg8000, pyodbc, pytest, pymysql, dateutil
4+, docutils, flexmock, psycopg2, pygments }:
5+
6+buildPythonPackage rec {
7+ pname = "sqlalchemy-utils";
8+ version = "0.34.0";
9+
10+ src = fetchPypi {
11+ inherit version;
12+ pname = "SQLAlchemy-Utils";
13+ sha256 = "0rlixs084isgxsvvpz96njqzikvg8x021sgjp4yj71jpd8blvg8f";
14+ };
15+
16+ propagatedBuildInputs = [
17+ six
18+ sqlalchemy
19+ ];
20+
21+ # Attempts to access localhost and there's also no database access
22+ doCheck = false;
23+ checkInputs = [
24+ mock
25+ pytz
26+ isort
27+ flake8
28+ jinja2
29+ pg8000
30+ pyodbc
31+ pytest
32+ pymysql
33+ dateutil
34+ docutils
35+ flexmock
36+ psycopg2
37+ pygments
38+ ];
39+
40+ checkPhase = ''
41+ pytest tests
42+ '';
43+
44+ meta = with lib; {
45+ homepage = https://github.com/kvesteri/sqlalchemy-utils;
46+ description = "Various utility functions and datatypes for SQLAlchemy";
47+ license = licenses.bsd3;
48+ maintainers = with maintainers; [ eadwu ];
49+ };
50+}
pkgs/top-level/all-packages.nix+2
@@ -6146,6 +6146,8 @@ in
61466146
61476147 srcml = callPackage ../applications/version-management/srcml { };
61486148
6149+ sourcehut = callPackage ../applications/version-management/sourcehut { };
6150+
61496151 sshfs-fuse = callPackage ../tools/filesystems/sshfs-fuse { };
61506152 sshfs = sshfs-fuse; # added 2017-08-14
61516153
pkgs/top-level/python-packages.nix+22
@@ -519,6 +519,8 @@ in {
519519
520520 emcee = callPackage ../development/python-modules/emcee { };
521521
522+ emailthreads = callPackage ../development/python-modules/emailthreads { };
523+
522524 email_validator = callPackage ../development/python-modules/email-validator { };
523525
524526 ewmh = callPackage ../development/python-modules/ewmh { };
@@ -1014,6 +1016,8 @@ in {
10141016
10151017 pytest-mypy = callPackage ../development/python-modules/pytest-mypy { };
10161018
1019+ pytest-ordering = callPackage ../development/python-modules/pytest-ordering { };
1020+
10171021 pytest-pylint = callPackage ../development/python-modules/pytest-pylint { };
10181022
10191023 pytest-testmon = callPackage ../development/python-modules/pytest-testmon { };
@@ -1271,6 +1275,8 @@ in {
12711275
12721276 aiorpcx = callPackage ../development/python-modules/aiorpcx { };
12731277
1278+ aiosmtpd = callPackage ../development/python-modules/aiosmtpd { };
1279+
12741280 aiounifi = callPackage ../development/python-modules/aiounifi { };
12751281
12761282 aiozeroconf = callPackage ../development/python-modules/aiozeroconf { };
@@ -1342,8 +1348,12 @@ in {
13421348
13431349 astor = callPackage ../development/python-modules/astor {};
13441350
1351+ asyncpg = callPackage ../development/python-modules/asyncpg { };
1352+
13451353 asyncssh = callPackage ../development/python-modules/asyncssh { };
13461354
1355+ atpublic = callPackage ../development/python-modules/atpublic { };
1356+
13471357 python-fontconfig = callPackage ../development/python-modules/python-fontconfig { };
13481358
13491359 funcsigs = callPackage ../development/python-modules/funcsigs { };
@@ -2977,6 +2987,8 @@ in {
29772987
29782988 flake8-import-order = callPackage ../development/python-modules/flake8-import-order { };
29792989
2990+ flake8-polyfill = callPackage ../development/python-modules/flake8-polyfill { };
2991+
29802992 flaky = callPackage ../development/python-modules/flaky { };
29812993
29822994 flask = callPackage ../development/python-modules/flask { };
@@ -4071,6 +4083,8 @@ in {
40714083
40724084 pep8 = callPackage ../development/python-modules/pep8 { };
40734085
4086+ pep8-naming = callPackage ../development/python-modules/pep8-naming { };
4087+
40744088 pep257 = callPackage ../development/python-modules/pep257 { };
40754089
40764090 percol = callPackage ../development/python-modules/percol { };
@@ -4092,6 +4106,12 @@ in {
40924106
40934107 pgspecial = callPackage ../development/python-modules/pgspecial { };
40944108
4109+ pgpy = callPackage ../development/python-modules/pgpy {
4110+ cryptography = self.cryptography.override {
4111+ openssl = pkgs.openssl_1_1;
4112+ };
4113+ };
4114+
40954115 pickleshare = callPackage ../development/python-modules/pickleshare { };
40964116
40974117 piep = callPackage ../development/python-modules/piep { };
@@ -4838,6 +4858,8 @@ in {
48384858
48394859 sqlalchemy_migrate = callPackage ../development/python-modules/sqlalchemy-migrate { };
48404860
4861+ sqlalchemy-utils = callPackage ../development/python-modules/sqlalchemy-utils { };
4862+
48414863 staticjinja = callPackage ../development/python-modules/staticjinja { };
48424864
48434865 statsmodels = callPackage ../development/python-modules/statsmodels { };