diff --git a/pkgs/applications/version-management/sourcehut/builds.nix b/pkgs/applications/version-management/sourcehut/builds.nix new file mode 100644 index 00000000000..e554afe4a92 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/builds.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/core.nix b/pkgs/applications/version-management/sourcehut/core.nix new file mode 100644 index 00000000000..ca054c5cfde --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/core.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix new file mode 100644 index 00000000000..b7c8eaf3820 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/default.nix @@ -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; +} diff --git a/pkgs/applications/version-management/sourcehut/disable-npm-install.patch b/pkgs/applications/version-management/sourcehut/disable-npm-install.patch new file mode 100644 index 00000000000..3a8d1c82b34 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/disable-npm-install.patch @@ -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() + diff --git a/pkgs/applications/version-management/sourcehut/dispatch.nix b/pkgs/applications/version-management/sourcehut/dispatch.nix new file mode 100644 index 00000000000..c77fc902277 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/dispatch.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/git.nix b/pkgs/applications/version-management/sourcehut/git.nix new file mode 100644 index 00000000000..996663761a7 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/git.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/hg.nix b/pkgs/applications/version-management/sourcehut/hg.nix new file mode 100644 index 00000000000..93817648468 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/hg.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/lists.nix b/pkgs/applications/version-management/sourcehut/lists.nix new file mode 100644 index 00000000000..ac36a219a91 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/lists.nix @@ -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 ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/man.nix b/pkgs/applications/version-management/sourcehut/man.nix new file mode 100644 index 00000000000..a0198cb52cf --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/man.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchgit, buildPythonPackage +, python +, srht, pygit2 }: + +buildPythonPackage rec { + pname = "mansrht"; + version = "0.12.4"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/man.sr.ht"; + rev = version; + sha256 = "1csnw71yh5zw7l17xmmxyskwiqbls0ynbbjrg45y5k1i3622mhiy"; + }; + + patches = [ + ./use-srht-path.patch + ]; + + nativeBuildInputs = srht.nativeBuildInputs; + + propagatedBuildInputs = [ + srht + pygit2 + ]; + + preBuild = '' + export PKGVER=${version} + export SRHT_PATH=${srht}/${python.sitePackages}/srht + ''; + + meta = with stdenv.lib; { + homepage = https://git.sr.ht/~sircmpwn/man.sr.ht; + description = "Wiki service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/meta.nix b/pkgs/applications/version-management/sourcehut/meta.nix new file mode 100644 index 00000000000..af3685c472c --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/meta.nix @@ -0,0 +1,48 @@ +{ stdenv, fetchgit, buildPythonPackage +, python +, pgpy, srht, redis, bcrypt, qrcode, stripe, zxcvbn, alembic, pystache +, sshpubkeys, weasyprint, prometheus_client }: + +buildPythonPackage rec { + pname = "metasrht"; + version = "0.34.3"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/meta.sr.ht"; + rev = version; + sha256 = "1yj3npw1vlqawzj6q1mh6qryx009dg5prja9fn6rasfmxjn2gr7v"; + }; + + nativeBuildInputs = srht.nativeBuildInputs; + + propagatedBuildInputs = [ + pgpy + srht + redis + bcrypt + qrcode + stripe + zxcvbn + alembic + pystache + sshpubkeys + weasyprint + prometheus_client + ]; + + patches = [ + ./use-srht-path.patch + ]; + + preBuild = '' + export PKGVER=${version} + export SRHT_PATH=${srht}/${python.sitePackages}/srht + ''; + + meta = with stdenv.lib; { + homepage = https://git.sr.ht/~sircmpwn/meta.sr.ht; + description = "Account management service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/paste.nix b/pkgs/applications/version-management/sourcehut/paste.nix new file mode 100644 index 00000000000..47153d9f204 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/paste.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchgit, buildPythonPackage +, python +, srht, pyyaml }: + +buildPythonPackage rec { + pname = "pastesrht"; + version = "0.5.1"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/paste.sr.ht"; + rev = version; + sha256 = "0bzw03hcwi1pw16kliqjsr7kphqq3qw0pbpdjqkcs7jdr0a59vny"; + }; + + patches = [ + ./use-srht-path.patch + ]; + + nativeBuildInputs = srht.nativeBuildInputs; + + propagatedBuildInputs = [ + srht + pyyaml + ]; + + preBuild = '' + export PKGVER=${version} + export SRHT_PATH=${srht}/${python.sitePackages}/srht + ''; + + meta = with stdenv.lib; { + homepage = https://git.sr.ht/~sircmpwn/paste.sr.ht; + description = "Ad-hoc text file hosting service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/scm.nix b/pkgs/applications/version-management/sourcehut/scm.nix new file mode 100644 index 00000000000..ef6ed3a744b --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/scm.nix @@ -0,0 +1,55 @@ +{ stdenv, fetchgit, buildPythonPackage +, srht, redis, pyyaml, buildsrht +, writeText }: + +buildPythonPackage rec { + pname = "scmsrht"; + version = "0.13.3"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/scm.sr.ht"; + rev = version; + sha256 = "0bapddgfqrs27y6prd6kwpz6jdlr33zdqr6ci6ixi584a7z8z7d6"; + }; + + nativeBuildInputs = srht.nativeBuildInputs; + + propagatedBuildInputs = [ + srht + redis + pyyaml + buildsrht + ]; + + preBuild = '' + export PKGVER=${version} + ''; + + # No actual? tests but seems like it needs this anyway + preCheck = let + config = writeText "config.ini" '' + [webhooks] + private-key=K6JupPpnr0HnBjelKTQUSm3Ro9SgzEA2T2Zv472OvzI= + + [builds.sr.ht] + origin=http://builds.sr.ht.local + oauth-client-id= + + [meta.sr.ht] + origin=http://meta.sr.ht.local + ''; + in '' + # Validation needs config option(s) + # webhooks <- ( private-key ) + # meta.sr.ht <- ( origin ) + # builds.sr.ht <- ( origin, oauth-client-id ) + cp ${config} config.ini + ''; + + meta = with stdenv.lib; { + homepage = https://git.sr.ht/~sircmpwn/git.sr.ht; + description = "Shared support code for sr.ht source control services."; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/todo.nix b/pkgs/applications/version-management/sourcehut/todo.nix new file mode 100644 index 00000000000..6b67478aa67 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/todo.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchgit, buildPythonPackage +, python +, srht, redis, alembic, pystache }: + +buildPythonPackage rec { + pname = "todosrht"; + version = "0.46.8"; + + src = fetchgit { + url = "https://git.sr.ht/~sircmpwn/todo.sr.ht"; + rev = version; + sha256 = "17nqqy81535jnkidjiqv8v2301w5wzbbvx4czib69aagw1l85gnn"; + }; + + patches = [ + ./use-srht-path.patch + ]; + + nativeBuildInputs = srht.nativeBuildInputs; + + propagatedBuildInputs = [ + srht + redis + alembic + pystache + ]; + + preBuild = '' + export PKGVER=${version} + export SRHT_PATH=${srht}/${python.sitePackages}/srht + ''; + + # Tests require a network connection + doCheck = false; + + meta = with stdenv.lib; { + homepage = https://todo.sr.ht/~sircmpwn/todo.sr.ht; + description = "Ticket tracking service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh new file mode 100755 index 00000000000..fdc0639c4c6 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/update.sh @@ -0,0 +1,54 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p git mercurial common-updater-scripts + +cd "$(dirname "${BASH_SOURCE[0]}")" +root=../../../.. + +default() { + (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/') +} + +version() { + (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.version" | tr -d '"') +} + +src_url() { + (cd "$root" && nix-instantiate --eval --strict -A "sourcehut.python.pkgs.$1.src.drvAttrs.url" | tr -d '"') +} + +get_latest_version() { + src="$(src_url "$1")" + tmp=$(mktemp -d) + + if [ "$1" = "hgsrht" ]; then + hg clone "$src" "$tmp" &> /dev/null + printf "%s" "$(cd "$tmp" && hg log --limit 1 --template '{latesttag}')" + else + git clone "$src" "$tmp" + printf "%s" "$(cd "$tmp" && git describe $(git rev-list --tags --max-count=1))" + fi +} + +update_version() { + default_nix="$(default "$1")" + version_old="$(version "$1")" + version="$(get_latest_version "$1")" + + (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version") + + git add "$default_nix" + git commit -m "$1: $version_old -> $version" +} + +services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "listssrht" "mansrht" "metasrht" + "pastesrht" "todosrht" "scmsrht" ) + +# Whether or not a specific service is requested +if [ -n "$1" ]; then + version="$(get_latest_version "$1")" + (cd "$root" && update-source-version "sourcehut.python.pkgs.$1" "$version") +else + for service in "${services[@]}"; do + update_version "$service" + done +fi diff --git a/pkgs/applications/version-management/sourcehut/use-srht-path.patch b/pkgs/applications/version-management/sourcehut/use-srht-path.patch new file mode 100644 index 00000000000..43b494bf9d2 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/use-srht-path.patch @@ -0,0 +1,43 @@ +diff --git a/setup.py b/setup.py +index e6ecfb6..89fa92a 100755 +--- a/setup.py ++++ b/setup.py +@@ -5,28 +5,16 @@ import os + import site + import sys + +-if hasattr(site, 'getsitepackages'): +- pkg_dirs = site.getsitepackages() +- if site.getusersitepackages(): +- pkg_dirs.append(site.getusersitepackages()) +- for pkg_dir in pkg_dirs: +- srht_path = os.path.join(pkg_dir, "srht") +- if os.path.isdir(srht_path): +- break +- else: +- raise Exception("Can't find core srht module in your site packages " +- "directories. Please install it first.") +-else: +- srht_path = os.getenv("SRHT_PATH") +- if not srht_path: +- raise Exception("You're running inside a virtual environment. " +- "Due to virtualenv limitations, you need to set the " +- "$SRHT_PATH environment variable to the path of the " +- "core srht module.") +- elif not os.path.isdir(srht_path): +- raise Exception( +- "The $SRHT_PATH environment variable points to an invalid " +- "directory: {}".format(srht_path)) ++srht_path = os.getenv("SRHT_PATH") ++if not srht_path: ++ raise Exception("You're running inside a virtual environment. " ++ "Due to virtualenv limitations, you need to set the " ++ "$SRHT_PATH environment variable to the path of the " ++ "core srht module.") ++elif not os.path.isdir(srht_path): ++ raise Exception( ++ "The $SRHT_PATH environment variable points to an invalid " ++ "directory: {}".format(srht_path)) + + subp = subprocess.run(["make", "SRHT_PATH=" + srht_path]) + if subp.returncode != 0: diff --git a/pkgs/development/python-modules/aiosmtpd/default.nix b/pkgs/development/python-modules/aiosmtpd/default.nix new file mode 100644 index 00000000000..9e053c718c8 --- /dev/null +++ b/pkgs/development/python-modules/aiosmtpd/default.nix @@ -0,0 +1,32 @@ +{ lib, isPy3k, fetchPypi, buildPythonPackage +, atpublic }: + +buildPythonPackage rec { + pname = "aiosmtpd"; + version = "1.2"; + disabled = !isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "1xdfk741pjmz1cm8dsi4n5vq4517i175rm94696m3f7kcgk7xsmp"; + }; + + propagatedBuildInputs = [ + atpublic + ]; + + # Tests need network access + doCheck = false; + + meta = with lib; { + homepage = https://aiosmtpd.readthedocs.io/en/latest/; + description = "Asyncio based SMTP server"; + longDescription = '' + This is a server for SMTP and related protocols, similar in utility to the + standard library's smtpd.py module, but rewritten to be based on asyncio for + Python 3. + ''; + license = licenses.asl20; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/asyncpg/default.nix b/pkgs/development/python-modules/asyncpg/default.nix new file mode 100644 index 00000000000..a71ffd85367 --- /dev/null +++ b/pkgs/development/python-modules/asyncpg/default.nix @@ -0,0 +1,38 @@ +{ lib, isPy3k, fetchPypi, fetchpatch, buildPythonPackage +, uvloop, postgresql }: + +buildPythonPackage rec { + pname = "asyncpg"; + version = "0.18.3"; + disabled = !isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "0rrch478ww6ipmh3617sb2jzwsq4w7pjcck869p35zb0mk5fr9aq"; + }; + + patches = [ + (fetchpatch { + url = "https://github.com/MagicStack/asyncpg/commit/aaeb7076e5acb045880b46155014c0640624797e.patch"; + sha256 = "0r6g6pvb39vzci8g67mv9rlrvavqvfz6vlv8988wv53bpz1mss3p"; + }) + ]; + + checkInputs = [ + uvloop + postgresql + ]; + + meta = with lib; { + homepage = https://github.com/MagicStack/asyncpg; + description = "An asyncio PosgtreSQL driver"; + longDescription = '' + Asyncpg is a database interface library designed specifically for + PostgreSQL and Python/asyncio. asyncpg is an efficient, clean + implementation of PostgreSQL server binary protocol for use with Python’s + asyncio framework. + ''; + license = licenses.asl20; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/atpublic/default.nix b/pkgs/development/python-modules/atpublic/default.nix new file mode 100644 index 00000000000..6657b41cc78 --- /dev/null +++ b/pkgs/development/python-modules/atpublic/default.nix @@ -0,0 +1,38 @@ +{ lib, isPy3k, fetchPypi, buildPythonPackage +, pytest }: + +buildPythonPackage rec { + pname = "atpublic"; + version = "1.0"; + disabled = !isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "0i3sbxkdlbb4560rrlmwwd5y4ps7k73lp4d8wnmd7ag9k426gjkx"; + }; + + checkInputs = [ + pytest + ]; + + checkPhase = '' + pytest --pyargs public + ''; + + meta = with lib; { + homepage = https://public.readthedocs.io/en/latest/; + description = "A decorator and function which populates a module's __all__ and globals"; + longDescription = '' + This is a very simple decorator and function which populates a module's + __all__ and optionally the module globals. + + This provides both a pure-Python implementation and a C implementation. It is + proposed that the C implementation be added to builtins_ for Python 3.6. + + This proposal seems to have been rejected, for more information see + https://bugs.python.org/issue26632. + ''; + license = licenses.asl20; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/emailthreads/default.nix b/pkgs/development/python-modules/emailthreads/default.nix new file mode 100644 index 00000000000..0e5db1de3e9 --- /dev/null +++ b/pkgs/development/python-modules/emailthreads/default.nix @@ -0,0 +1,29 @@ +{ lib, fetchFromGitHub, buildPythonPackage +, python, isPy3k }: + +buildPythonPackage rec { + pname = "emailthreads"; + version = "0.1.0"; + disabled = !isPy3k; + + # pypi is missing files for tests + src = fetchFromGitHub { + owner = "emersion"; + repo = "python-emailthreads"; + rev = "v${version}"; + sha256 = "17pfal8kbxhs025apkijqbkppw2lljca8x1cwcx49jv60h05c3cn"; + }; + + PKGVER = version; + + checkPhase = '' + ${python.interpreter} -m unittest discover test + ''; + + meta = with lib; { + homepage = https://github.com/emersion/python-emailthreads; + description = "Python library to parse and format email threads"; + license = licenses.mit; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/flake8-polyfill/default.nix b/pkgs/development/python-modules/flake8-polyfill/default.nix new file mode 100644 index 00000000000..070e6997010 --- /dev/null +++ b/pkgs/development/python-modules/flake8-polyfill/default.nix @@ -0,0 +1,40 @@ +{ lib, fetchPypi, buildPythonPackage +, flake8 +, mock, pep8, pytest }: + +buildPythonPackage rec { + pname = "flake8-polyfill"; + version = "1.0.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "1nlf1mkqw856vi6782qcglqhaacb23khk9wkcgn55npnjxshhjz4"; + }; + + postPatch = '' + # Failed: [pytest] section in setup.cfg files is no longer supported, change to [tool:pytest] instead. + substituteInPlace setup.cfg \ + --replace pytest 'tool:pytest' + ''; + + propagatedBuildInputs = [ + flake8 + ]; + + checkInputs = [ + mock + pep8 + pytest + ]; + + checkPhase = '' + pytest tests + ''; + + meta = with lib; { + homepage = https://gitlab.com/pycqa/flake8-polyfill; + description = "Polyfill package for Flake8 plugins"; + license = licenses.mit; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/pep8-naming/default.nix b/pkgs/development/python-modules/pep8-naming/default.nix new file mode 100644 index 00000000000..20da40560e2 --- /dev/null +++ b/pkgs/development/python-modules/pep8-naming/default.nix @@ -0,0 +1,23 @@ +{ lib, fetchPypi, buildPythonPackage +, flake8-polyfill }: + +buildPythonPackage rec { + pname = "pep8-naming"; + version = "0.8.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "1aff4g3i2z08cx7z17nbxbf32ddrnvqlk16h6d8h9s9w5ymivjq1"; + }; + + propagatedBuildInputs = [ + flake8-polyfill + ]; + + meta = with lib; { + homepage = https://github.com/PyCQA/pep8-naming; + description = "Check PEP-8 naming conventions, plugin for flake8"; + license = licenses.mit; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/pgpy/default.nix b/pkgs/development/python-modules/pgpy/default.nix new file mode 100644 index 00000000000..50220bb3993 --- /dev/null +++ b/pkgs/development/python-modules/pgpy/default.nix @@ -0,0 +1,48 @@ +{ lib, isPy3k, fetchFromGitHub, buildPythonPackage +, six, enum34, pyasn1, cryptography, singledispatch +, fetchPypi +, gpgme, flake8, pytest, pytestcov, pep8-naming, pytest-ordering }: + +buildPythonPackage rec { + pname = "pgpy"; + version = "0.5.2"; + + src = fetchFromGitHub { + owner = "SecurityInnovation"; + repo = "PGPy"; + rev = version; + sha256 = "1v2b1dyq1sl48d2gw7vn4hv6sasd9ihpzzcq8yvxj9dgfak2y663"; + }; + + propagatedBuildInputs = [ + six + pyasn1 + cryptography + singledispatch + ] ++ lib.optional (!isPy3k) enum34; + + checkInputs = [ + gpgme + flake8 + pytest + pytestcov + pep8-naming + pytest-ordering + ]; + + checkPhase = '' + pytest + ''; + + meta = with lib; { + homepage = https://github.com/SecurityInnovation/PGPy; + description = "Pretty Good Privacy for Python 2 and 3"; + longDescription = '' + PGPy is a Python (2 and 3) library for implementing Pretty Good Privacy + into Python programs, conforming to the OpenPGP specification per RFC + 4880. + ''; + license = licenses.bsd3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/pytest-ordering/default.nix b/pkgs/development/python-modules/pytest-ordering/default.nix new file mode 100644 index 00000000000..ec340806964 --- /dev/null +++ b/pkgs/development/python-modules/pytest-ordering/default.nix @@ -0,0 +1,31 @@ +{ lib, fetchFromGitHub, buildPythonPackage +, pytest }: + +buildPythonPackage rec { + pname = "pytest-ordering"; + version = "unstable-2019-06-19"; + + # Pypi lacks tests/ + # Resolves PytestUnknownMarkWarning from pytest + src = fetchFromGitHub { + owner = "ftobia"; + repo = pname; + rev = "492697ee26633cc31d329c1ceaa468375ee8ee9c"; + sha256 = "1xim0kj5g37p1skgvp8gdylpx949krmx60w3pw6j1m1h7sakmddn"; + }; + + checkInputs = [ + pytest + ]; + + checkPhase = '' + pytest tests + ''; + + meta = with lib; { + homepage = https://github.com/ftobia/pytest-ordering; + description = "Pytest plugin to run your tests in a specific order"; + license = licenses.mit; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/development/python-modules/sqlalchemy-utils/default.nix b/pkgs/development/python-modules/sqlalchemy-utils/default.nix new file mode 100644 index 00000000000..1212b6c94b0 --- /dev/null +++ b/pkgs/development/python-modules/sqlalchemy-utils/default.nix @@ -0,0 +1,50 @@ +{ lib, fetchPypi, buildPythonPackage +, six, sqlalchemy +, mock, pytz, isort, flake8, jinja2, pg8000, pyodbc, pytest, pymysql, dateutil +, docutils, flexmock, psycopg2, pygments }: + +buildPythonPackage rec { + pname = "sqlalchemy-utils"; + version = "0.34.0"; + + src = fetchPypi { + inherit version; + pname = "SQLAlchemy-Utils"; + sha256 = "0rlixs084isgxsvvpz96njqzikvg8x021sgjp4yj71jpd8blvg8f"; + }; + + propagatedBuildInputs = [ + six + sqlalchemy + ]; + + # Attempts to access localhost and there's also no database access + doCheck = false; + checkInputs = [ + mock + pytz + isort + flake8 + jinja2 + pg8000 + pyodbc + pytest + pymysql + dateutil + docutils + flexmock + psycopg2 + pygments + ]; + + checkPhase = '' + pytest tests + ''; + + meta = with lib; { + homepage = https://github.com/kvesteri/sqlalchemy-utils; + description = "Various utility functions and datatypes for SQLAlchemy"; + license = licenses.bsd3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c560fa67271..e0ec4cf3bfa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6146,6 +6146,8 @@ in srcml = callPackage ../applications/version-management/srcml { }; + sourcehut = callPackage ../applications/version-management/sourcehut { }; + sshfs-fuse = callPackage ../tools/filesystems/sshfs-fuse { }; sshfs = sshfs-fuse; # added 2017-08-14 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index eada8bf669e..152c5c26122 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -519,6 +519,8 @@ in { emcee = callPackage ../development/python-modules/emcee { }; + emailthreads = callPackage ../development/python-modules/emailthreads { }; + email_validator = callPackage ../development/python-modules/email-validator { }; ewmh = callPackage ../development/python-modules/ewmh { }; @@ -1014,6 +1016,8 @@ in { pytest-mypy = callPackage ../development/python-modules/pytest-mypy { }; + pytest-ordering = callPackage ../development/python-modules/pytest-ordering { }; + pytest-pylint = callPackage ../development/python-modules/pytest-pylint { }; pytest-testmon = callPackage ../development/python-modules/pytest-testmon { }; @@ -1271,6 +1275,8 @@ in { aiorpcx = callPackage ../development/python-modules/aiorpcx { }; + aiosmtpd = callPackage ../development/python-modules/aiosmtpd { }; + aiounifi = callPackage ../development/python-modules/aiounifi { }; aiozeroconf = callPackage ../development/python-modules/aiozeroconf { }; @@ -1342,8 +1348,12 @@ in { astor = callPackage ../development/python-modules/astor {}; + asyncpg = callPackage ../development/python-modules/asyncpg { }; + asyncssh = callPackage ../development/python-modules/asyncssh { }; + atpublic = callPackage ../development/python-modules/atpublic { }; + python-fontconfig = callPackage ../development/python-modules/python-fontconfig { }; funcsigs = callPackage ../development/python-modules/funcsigs { }; @@ -2977,6 +2987,8 @@ in { flake8-import-order = callPackage ../development/python-modules/flake8-import-order { }; + flake8-polyfill = callPackage ../development/python-modules/flake8-polyfill { }; + flaky = callPackage ../development/python-modules/flaky { }; flask = callPackage ../development/python-modules/flask { }; @@ -4071,6 +4083,8 @@ in { pep8 = callPackage ../development/python-modules/pep8 { }; + pep8-naming = callPackage ../development/python-modules/pep8-naming { }; + pep257 = callPackage ../development/python-modules/pep257 { }; percol = callPackage ../development/python-modules/percol { }; @@ -4092,6 +4106,12 @@ in { pgspecial = callPackage ../development/python-modules/pgspecial { }; + pgpy = callPackage ../development/python-modules/pgpy { + cryptography = self.cryptography.override { + openssl = pkgs.openssl_1_1; + }; + }; + pickleshare = callPackage ../development/python-modules/pickleshare { }; piep = callPackage ../development/python-modules/piep { }; @@ -4838,6 +4858,8 @@ in { sqlalchemy_migrate = callPackage ../development/python-modules/sqlalchemy-migrate { }; + sqlalchemy-utils = callPackage ../development/python-modules/sqlalchemy-utils { }; + staticjinja = callPackage ../development/python-modules/staticjinja { }; statsmodels = callPackage ../development/python-modules/statsmodels { };