Last active
May 7, 2021 19:40
-
-
Save datakurre/4c6bf3438d015271896d7141f66bee8d to your computer and use it in GitHub Desktop.
another nix python packaging example
This file contains hidden or 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
diff --git a/setup.py b/setup.py | |
index a15336d..307fb56 100644 | |
--- a/setup.py | |
+++ b/setup.py | |
@@ -60,6 +60,9 @@ setuptools.setup( | |
"Programming Language :: Python :: 3.7", | |
"Programming Language :: Python :: 3.8", | |
], | |
+ entry_points={"console_scripts": [ | |
+ "mautrix-hangouts = mautrix_hangouts.__main__:main" | |
+ ]}, | |
package_data={"mautrix_hangouts": [ | |
"web/static/*.png", "web/static/*.css", "web/static/*.html", "web/static/*.js", | |
"example-config.yaml" |
This file contains hidden or 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
{ pkgs ? import <nixpkgs> {} | |
}: | |
(import ./setup.nix {}).targetPython.pkgs.mautrix-hangouts |
This file contains hidden or 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
# Generated by pip2nix 0.8.0.dev1 | |
# See https://github.com/nix-community/pip2nix | |
{ pkgs, fetchurl, fetchgit, fetchhg }: | |
self: super: { | |
"ConfigArgParse" = super.buildPythonPackage rec { | |
pname = "ConfigArgParse"; | |
version = "1.2.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/bb/79/3045743bb26ca2e44a1d317c37395462bfed82dbbd38e69a3280b63696ce/ConfigArgParse-1.2.3.tar.gz"; | |
sha256 = "1p1pzpf5qpf80bfxsx1mbw9blyhhypjvhl3i60pbmhfmhvlpplgd"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"Mako" = super.buildPythonPackage rec { | |
pname = "Mako"; | |
version = "1.1.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/a6/37/0e706200d22172eb8fa17d68a7ae22dec7631a0a92266634fb518a88a5b2/Mako-1.1.3-py2.py3-none-any.whl"; | |
sha256 = "1adnqx2q5mnjrhj675vfjhl80xdry46y5nbbhxy79w2giqjrlwlk"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."MarkupSafe" | |
]; | |
}; | |
"MarkupSafe" = super.buildPythonPackage rec { | |
pname = "MarkupSafe"; | |
version = "1.1.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz"; | |
sha256 = "0sqipg4fk7xbixqd8kq6rlkxj664d157bdwbh93farcphf92x1r9"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"MechanicalSoup" = super.buildPythonPackage rec { | |
pname = "MechanicalSoup"; | |
version = "0.12.0"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/0b/fe/4f871ec3379080c5979815bfec3266871e555eebf4879f551a7e5dee4766/MechanicalSoup-0.12.0-py2.py3-none-any.whl"; | |
sha256 = "0f2j1pi7wq0f42imyaik7szfcm3qd7s3sivs2gyxlkszjyq81pfd"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."beautifulsoup4" | |
self."lxml" | |
self."requests" | |
self."six" | |
]; | |
}; | |
"ReParser" = super.buildPythonPackage rec { | |
pname = "ReParser"; | |
version = "1.4.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/a7/eb/8bd06ddaeb3d5963abb0e2e2f14f2fa975b32fafe198254bfb4106ed9415/ReParser-1.4.3.tar.gz"; | |
sha256 = "0nniqb69xr0fv7ydlmrr877wyyjb61nlayka7xr08vlxl9caz776"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"SQLAlchemy" = super.buildPythonPackage rec { | |
pname = "SQLAlchemy"; | |
version = "1.3.20"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/69/ef/6d18860e18db68b8f25e0d268635f2f8cefa7a1cbf6d9d9f90214555a364/SQLAlchemy-1.3.20.tar.gz"; | |
sha256 = "18b9am7bsqc4nj3d2h5r93i002apczxfvpfpcqbd6f0385zmrwnj"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"aiohttp" = super.buildPythonPackage rec { | |
pname = "aiohttp"; | |
version = "3.6.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/9d/6c/429faa2d2f73973189ca0cfe141ff703417a5eebe18d78e6b25b70db0a34/aiohttp-3.6.3.tar.gz"; | |
sha256 = "0i9n7h8n06m2d8ryqyk4fv1si1m44ibq7blbfaxq46vx7jydg339"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."async-timeout" | |
self."attrs" | |
self."chardet" | |
self."multidict" | |
self."yarl" | |
]; | |
}; | |
"alembic" = super.buildPythonPackage rec { | |
pname = "alembic"; | |
version = "1.4.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/12/aa/c261dfd7f4ba6ce4701846a2689a46e2a172e012171de4378fc2926e3bf0/alembic-1.4.3-py2.py3-none-any.whl"; | |
sha256 = "0760f83chg376lcdc6fyfyq1zdam5h4zl6h4cnciggcnlwmfs0jf"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."Mako" | |
self."SQLAlchemy" | |
self."python-dateutil" | |
self."python-editor" | |
]; | |
}; | |
"appdirs" = super.buildPythonPackage rec { | |
pname = "appdirs"; | |
version = "1.4.4"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/3b/00/2344469e2084fb287c2e0b57b72910309874c3245463acd6cf5e3db69324/appdirs-1.4.4-py2.py3-none-any.whl"; | |
sha256 = "0a5ib82s2335nhvq5rjh8hkimrwyw43xnshn3ds8lccrdg6xlhd8"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"async-timeout" = super.buildPythonPackage rec { | |
pname = "async-timeout"; | |
version = "3.0.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl"; | |
sha256 = "18wy5w0wk37ikx9n5yc8s9746bgqz3wdddbc1d6jfz98glcwm4a2"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"attrs" = super.buildPythonPackage rec { | |
pname = "attrs"; | |
version = "20.2.0"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/14/df/479736ae1ef59842f512548bacefad1abed705e400212acba43f9b0fa556/attrs-20.2.0-py2.py3-none-any.whl"; | |
sha256 = "1p2mwqh0sykp2dm8h86d3b100xs0l0pzjgymh8p1axn9vx3zrrzw"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"beautifulsoup4" = super.buildPythonPackage rec { | |
pname = "beautifulsoup4"; | |
version = "4.9.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/d1/41/e6495bd7d3781cee623ce23ea6ac73282a373088fcd0ddc809a047b18eae/beautifulsoup4-4.9.3-py3-none-any.whl"; | |
sha256 = "0rmn9z026in04c2y12x3xsdfczgyjbssh3g02yzq5v1l3q1pxx7z"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."soupsieve" | |
]; | |
}; | |
"certifi" = super.buildPythonPackage rec { | |
pname = "certifi"; | |
version = "2020.6.20"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl"; | |
sha256 = "0hgw963hnmp907cpbsv81x19zn84xywzzkjcnfyibfih3ygq3h4g"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"chardet" = super.buildPythonPackage rec { | |
pname = "chardet"; | |
version = "3.0.4"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl"; | |
sha256 = "14b621614q2lw7ik2igdv4qdbblqgdsiglgl5fhf1l5fmvy3ycpw"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"commonmark" = super.buildPythonPackage rec { | |
pname = "commonmark"; | |
version = "0.9.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/b1/92/dfd892312d822f36c55366118b95d914e5f16de11044a27cf10a7d71bbbf/commonmark-0.9.1-py2.py3-none-any.whl"; | |
sha256 = "1nbgsvb73ad93cjzjdggkpp4zizvxay3q6ms23j3vy4h4p4khbys"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"hangups" = super.buildPythonPackage rec { | |
pname = "hangups"; | |
version = "0.4.12"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/ea/e7/2e59d47d8d3071b8b92b5f633e600ebe9d8210f566c895e988d88161e9a1/hangups-0.4.12.tar.gz"; | |
sha256 = "06vhn5mx2h4b1rgwwhqbi1kx1mwddd55ygkc5jfaqpwisbmfv9hs"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."ConfigArgParse" | |
self."MechanicalSoup" | |
self."ReParser" | |
self."aiohttp" | |
self."appdirs" | |
self."async-timeout" | |
self."protobuf" | |
self."readlike" | |
self."requests" | |
self."urwid" | |
]; | |
}; | |
"idna" = super.buildPythonPackage rec { | |
pname = "idna"; | |
version = "2.10"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl"; | |
sha256 = "1h280sli58v5dapmf79rnnqdrrk0xjn8vi3pxppknllv3r5q0zdr"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"lxml" = super.buildPythonPackage rec { | |
pname = "lxml"; | |
version = "4.6.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/c5/2f/a0d8aa3eee6d53d5723d89e1fc32eee11e76801b424e30b55c7aa6302b01/lxml-4.6.1.tar.gz"; | |
sha256 = "0rxkvjx6ffp8v3y6hdmqnsrfz3javr6a532sxhv1z7b37glv4ln1"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"mautrix" = super.buildPythonPackage rec { | |
pname = "mautrix"; | |
version = "0.7.13"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/df/cc/f04f4b521d9697fb71e4687354125f0e74c4510867785724ffcf1a2939bf/mautrix-0.7.13-py3-none-any.whl"; | |
sha256 = "14v75pamz0g9qx9w9qcqiqpidyk2m1agm23rbbd792fazqz4znfk"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."aiohttp" | |
self."attrs" | |
]; | |
}; | |
"mautrix-hangouts" = super.buildPythonPackage rec { | |
pname = "mautrix-hangouts"; | |
version = "0.1.3+dev.f83d69fe"; | |
src = fetchgit { | |
url = "git://github.com/rihardsk/mautrix-hangouts.git"; | |
rev = "f83d69fe43370207dfba22bba38ff2f421fa2971"; | |
sha256 = "06w5mf8d6dwq59w74pk74iffv08fxpk21b0n5amq8ln2cq32bxfb"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."SQLAlchemy" | |
self."aiohttp" | |
self."alembic" | |
self."commonmark" | |
self."hangups" | |
self."mautrix" | |
self."python-magic" | |
self."ruamel.yaml" | |
]; | |
}; | |
"multidict" = super.buildPythonPackage rec { | |
pname = "multidict"; | |
version = "4.7.6"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/65/d4/fabdcc5ee4451c8a8e177e27ddfd131a53a82ecc5a3b68468b7e9f8d70b4/multidict-4.7.6.tar.gz"; | |
sha256 = "0c0lp75p5z6zmpsy8ar099kj6kggi0yq4kld99y1w0i9wmspmdzv"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"protobuf" = super.buildPythonPackage rec { | |
pname = "protobuf"; | |
version = "3.13.0"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/25/ef/8f36bc7e4c3dcad241a9e7a51520d30712a7abc034343bed841ff4ea3289/protobuf-3.13.0.tar.gz"; | |
sha256 = "1dbx74p0w2vx5qg2ifmf9h4v45bpw0a5ik20c1h8zx9bpg4f10ka"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."setuptools" | |
self."six" | |
]; | |
}; | |
"python-dateutil" = super.buildPythonPackage rec { | |
pname = "python-dateutil"; | |
version = "2.8.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl"; | |
sha256 = "0answacgnckybm5iyfnaqsgval3mdbpak4i6fsbi2vv8x8qkzfvm"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."six" | |
]; | |
}; | |
"python-editor" = super.buildPythonPackage rec { | |
pname = "python-editor"; | |
version = "1.0.4"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/c6/d3/201fc3abe391bbae6606e6f1d598c15d367033332bd54352b12f35513717/python_editor-1.0.4-py3-none-any.whl"; | |
sha256 = "0z9nr2npc0ghk0jh436qirhk082vq9fjs9g17r6a2lmdm1hfixhv"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"python-magic" = super.buildPythonPackage rec { | |
pname = "python-magic"; | |
version = "0.4.18"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/59/77/c76dc35249df428ce2c38a3196e2b2e8f9d2f847a8ca1d4d7a3973c28601/python_magic-0.4.18-py2.py3-none-any.whl"; | |
sha256 = "0mbk41rciqq5qd6aznvf6yqzb8hvhwgbjgkxxg8lg449r29zlvim"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"readlike" = super.buildPythonPackage rec { | |
pname = "readlike"; | |
version = "0.1.3"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/71/02/d639167c3ed84b9c3040bc99ed97be67796b53635f0c4f23392918428324/readlike-0.1.3-py3-none-any.whl"; | |
sha256 = "0096zqa3nmn3zyi5yfjkzsscpy556zdsv2yqhd41gp5sqyd1fym8"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"requests" = super.buildPythonPackage rec { | |
pname = "requests"; | |
version = "2.24.0"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl"; | |
sha256 = "165qrd22rm0fp23kzfdc6qy12jv0fm7j4jbhzi394fs4m6acqxgy"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."certifi" | |
self."chardet" | |
self."idna" | |
self."urllib3" | |
]; | |
}; | |
"ruamel.yaml" = super.buildPythonPackage rec { | |
pname = "ruamel.yaml"; | |
version = "0.16.12"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/7e/39/186f14f3836ac5d2a6a042c8de69988770e8b9abb537610edc429e4914aa/ruamel.yaml-0.16.12-py2.py3-none-any.whl"; | |
sha256 = "19a0ccwafwzahx2a0ch2xrpb9xpdfw195rwr9vjf81pal1q98aq1"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."ruamel.yaml.clib" | |
]; | |
}; | |
"ruamel.yaml.clib" = super.buildPythonPackage rec { | |
pname = "ruamel.yaml.clib"; | |
version = "0.2.2"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/fa/a1/f9c009a633fce3609e314294c7963abe64934d972abea257dce16a15666f/ruamel.yaml.clib-0.2.2.tar.gz"; | |
sha256 = "19vbh07cmn6jchqpcfpvldb9rcb05bfbq5fpqj84jvv7mycbs91d"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"six" = super.buildPythonPackage rec { | |
pname = "six"; | |
version = "1.15.0"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl"; | |
sha256 = "1vaw9aqdsbg84s20yqmg24k5kcq65dpxg4bldpzkijmspgfbwx4b"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"soupsieve" = super.buildPythonPackage rec { | |
pname = "soupsieve"; | |
version = "2.0.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/6f/8f/457f4a5390eeae1cc3aeab89deb7724c965be841ffca6cfca9197482e470/soupsieve-2.0.1-py3-none-any.whl"; | |
sha256 = "0mfcbvcs00p9id94fpbjy088da3hg3gr76rh8v9x6wdk5ajfwd0n"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"urllib3" = super.buildPythonPackage rec { | |
pname = "urllib3"; | |
version = "1.25.11"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/56/aa/4ef5aa67a9a62505db124a5cb5262332d1d4153462eb8fd89c9fa41e5d92/urllib3-1.25.11-py2.py3-none-any.whl"; | |
sha256 = "0pnxjyc33d162wrxmk285av9x44h9sqpzzhbzl7gmzpk9fz1ycpm"; | |
}; | |
format = "wheel"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"urwid" = super.buildPythonPackage rec { | |
pname = "urwid"; | |
version = "2.1.2"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/94/3f/e3010f4a11c08a5690540f7ebd0b0d251cc8a456895b7e49be201f73540c/urwid-2.1.2.tar.gz"; | |
sha256 = "1bky2bra6673xx8jy0826znw6cmxs89wcwwzda8d025j3jffx2sq"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = []; | |
}; | |
"yarl" = super.buildPythonPackage rec { | |
pname = "yarl"; | |
version = "1.5.1"; | |
src = fetchurl { | |
url = "https://files.pythonhosted.org/packages/ac/dd/59768bb3fa08e8b23e91575bca3ff8d2edbfbceebec8c59eaa24c4215791/yarl-1.5.1.tar.gz"; | |
sha256 = "1mn3avw5hnx31j03f6z0qx6q0glaw18saph40mqx9wwlyfspab62"; | |
}; | |
format = "setuptools"; | |
doCheck = false; | |
buildInputs = []; | |
checkInputs = []; | |
nativeBuildInputs = []; | |
propagatedBuildInputs = [ | |
self."idna" | |
self."multidict" | |
]; | |
}; | |
} |
This file contains hidden or 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
{ pkgs ? import (fetchTarball { # NixOS 20.09 | |
url = "https://github.com/NixOS/nixpkgs/archive/cd63096d6d887d689543a0b97743d28995bc9bc3.tar.gz"; | |
sha256 = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy"; | |
}) { config = { allowBroken = true; }; } | |
, python ? "python38" | |
, pythonPackages ? builtins.getAttr (python + "Packages") pkgs | |
, requirements ? ./. + "/python-packages.nix" | |
}: | |
with builtins; | |
with pkgs; | |
with pkgs.lib; | |
let | |
# Load generated requirements | |
requirementsFunc = import requirements { | |
inherit pkgs; | |
inherit (builtins) fetchurl; | |
inherit (pkgs) fetchgit fetchhg; | |
}; | |
# List package names in requirements | |
requirementsNames = attrNames (requirementsFunc {} {}); | |
# Return base name from python drv name or name when not python drv | |
pythonNameOrName = drv: | |
if hasAttr "overridePythonAttrs" drv then drv.pname else drv.name; | |
# Merge named input list from nixpkgs drv with input list from requirements drv | |
mergedInputs = old: new: inputsName: self: super: | |
(attrByPath [ inputsName ] [] new) ++ map | |
(x: attrByPath [ (pythonNameOrName x) ] x self) | |
(filter (x: !isNull x) (attrByPath [ inputsName ] [] old)); | |
# Merge package drv from nixpkgs drv with requirements drv | |
mergedPackage = old: new: self: super: | |
if isString new.src | |
&& !isNull (match ".*\.whl" new.src) # do not merge build inputs for wheels | |
&& new.pname != "wheel" # ... | |
then new.overridePythonAttrs(old: rec { | |
propagatedBuildInputs = | |
mergedInputs old new "propagatedBuildInputs" self super; | |
}) | |
else old.overridePythonAttrs(old: rec { | |
inherit (new) pname version src; | |
name = "${pname}-${version}"; | |
checkInputs = | |
mergedInputs old new "checkInputs" self super; | |
buildInputs = | |
mergedInputs old new "buildInputs" self super; | |
nativeBuildInputs = | |
mergedInputs old new "nativeBuildInputs" self super; | |
propagatedBuildInputs = | |
mergedInputs old new "propagatedBuildInputs" self super; | |
doCheck = false; | |
}); | |
# Build python with manual aliases for naming differences between world and nix | |
buildPython = (pythonPackages.python.override { | |
packageOverrides = self: super: | |
listToAttrs (map (name: { | |
name = name; value = getAttr (getAttr name aliases) super; | |
}) (filter (x: hasAttr (getAttr x aliases) super) (attrNames aliases))); | |
}); | |
# Build target python with all generated & customized requirements | |
targetPython = (buildPython.override { | |
packageOverrides = self: super: | |
# 1) Merge packages already in pythonPackages | |
let super_ = (requirementsFunc self buildPython.pkgs); # from requirements | |
results = (listToAttrs (map (name: let new = getAttr name super_; in { | |
inherit name; | |
value = mergedPackage (getAttr name buildPython.pkgs) new self super_; | |
}) | |
(filter (name: hasAttr "overridePythonAttrs" | |
(if (tryEval (attrByPath [ name ] {} buildPython.pkgs)).success | |
then (attrByPath [ name ] {} buildPython.pkgs) else {})) | |
requirementsNames))) | |
// # 2) with packages only in requirements or disabled in nixpkgs | |
(listToAttrs (map (name: { inherit name; value = (getAttr name super_); }) | |
(filter (name: (! ((hasAttr name buildPython.pkgs) && | |
(tryEval (getAttr name buildPython.pkgs)).success))) | |
requirementsNames))); | |
in # 3) finally, apply overrides (with aliased drvs mapped back) | |
(let final = (super // (results // | |
(listToAttrs (map (name: { | |
name = getAttr name aliases; value = getAttr name results; | |
}) (filter (x: hasAttr x results) (attrNames aliases)))) | |
)); in (final // (overrides self final))); | |
self = buildPython; | |
}); | |
# Helper to always return a list | |
asList = name: attrs: | |
if hasAttr name attrs then | |
let candidate = getAttr name attrs; in | |
if isList candidate then candidate else [] | |
else []; | |
# Alias packages with different names in requirements and in nixpkgs | |
aliases = { | |
}; | |
# Final overrides to fix issues all the magic above cannot fix automatically | |
overrides = self: super: { | |
"protobuf" = super."protobuf".overridePythonAttrs(old: { | |
prePatch = ""; | |
}); | |
"mautrix-hangouts" = super."mautrix-hangouts".overridePythonAttrs(old: { | |
patches = [ ./02-add-entrypoints.patch ]; | |
}); | |
"six" = buildPython.pkgs."six"; | |
"python-dateutil" = buildPython.pkgs."python-dateutil"; | |
"python-magic" = buildPython.pkgs."python_magic"; | |
}; | |
in rec { | |
inherit buildPython targetPython; | |
python = targetPython.withPackages(ps: map (name: getAttr name ps) requirementsNames); | |
env = pkgs.buildEnv { | |
name = "env"; | |
paths = [ | |
python | |
]; | |
}; | |
shell = pkgs.mkShell { | |
buildInputs = [ | |
python | |
]; | |
}; | |
} |
This file contains hidden or 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
{ pkgs ? import <nixpkgs> {} | |
}: | |
pkgs.mkShell { | |
buildInputs = [ | |
(import ./setup.nix {}).python | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment