nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 python3,
4 fetchPypi,
5 fetchFromGitHub,
6 fetchpatch,
7 git,
8 postgresql,
9 postgresqlTestHook,
10 valkey,
11 redisTestHook,
12}:
13
14let
15 py = python3.override {
16 self = py;
17 packageOverrides = final: prev: {
18 # sqlalchemy 2.0 is not supported
19 sqlalchemy = prev.sqlalchemy_1_4;
20
21 # checkInputs do not work wiht sqlalchemy < 2.0
22 factory-boy = prev.factory-boy.overridePythonAttrs (
23 lib.const {
24 doCheck = false;
25 }
26 );
27
28 # https://github.com/irrdnet/irrd/blob/22fe77e46ef1b4e43e346257795e171e7ee70d44/pyproject.toml#L30
29 beautifultable = prev.beautifultable.overridePythonAttrs (oldAttrs: rec {
30 version = "0.8.0";
31 src = fetchPypi {
32 inherit (oldAttrs) pname;
33 inherit version;
34 hash = "sha256-1E2VUbvte/qIZ1Mk+E77mqhXOE1E6fsh61MPCgutuBU=";
35 };
36 doCheck = false;
37 });
38 };
39 };
40in
41
42py.pkgs.buildPythonPackage rec {
43 pname = "irrd";
44 version = "4.5.0b1";
45 format = "pyproject";
46
47 src = fetchFromGitHub {
48 owner = "irrdnet";
49 repo = "irrd";
50 rev = "v${version}";
51 hash = "sha256-Hr/PbC4N/yrYeQ7bTfqIchDFmaL3c4afxV1XS7FR1F8=";
52 };
53
54 postPatch = ''
55 substituteInPlace pyproject.toml \
56 --replace-fail py-radix py-radix-sr
57 '';
58 pythonRelaxDeps = true;
59
60 nativeBuildInputs = with python3.pkgs; [
61 poetry-core
62 ];
63
64 nativeCheckInputs = [
65 git
66 valkey
67 redisTestHook
68 postgresql
69 postgresqlTestHook
70 ]
71 ++ (with py.pkgs; [
72 pytest-asyncio
73 pytest-freezegun
74 pytestCheckHook
75 smtpdfix
76 httpx
77 ]);
78
79 propagatedBuildInputs =
80 with py.pkgs;
81 [
82 python-gnupg
83 passlib
84 bcrypt
85 ipy
86 ordered-set
87 beautifultable
88 pyyaml
89 datrie
90 setproctitle
91 python-daemon
92 pid
93 py.pkgs.redis
94 hiredis
95 coredis
96 requests
97 pytz
98 ariadne
99 uvicorn
100 starlette
101 psutil
102 asgiref
103 pydantic
104 typing-extensions
105 py-radix-sr
106 psycopg2-binary
107 sqlalchemy
108 alembic
109 ujson
110 wheel
111 websockets
112 limits
113 factory-boy
114 webauthn
115 wtforms
116 imia
117 starlette-wtf
118 zxcvbn
119 pyotp
120 asgi-logger
121 wtforms-bootstrap5
122 email-validator
123 jinja2
124 joserfc
125 time-machine
126 ]
127 ++ py.pkgs.uvicorn.optional-dependencies.standard;
128
129 preCheck = ''
130 export SMTPD_HOST=127.0.0.1
131 export IRRD_DATABASE_URL="postgresql:///$PGDATABASE"
132 export IRRD_REDIS_URL="redis://localhost/1"
133 '';
134
135 # required for test_object_writing_and_status_checking
136 postgresqlTestSetupPost = ''
137 echo "track_commit_timestamp=on" >> $PGDATA/postgresql.conf
138 pg_ctl restart
139 '';
140
141 postCheck = ''
142 kill $REDIS_PID
143 '';
144
145 # skip tests that require internet access
146 disabledTests = [
147 "test_020_dash_o_noop"
148 "test_050_non_json_response"
149 ];
150
151 meta = {
152 changelog = "https://irrd.readthedocs.io/en/v${version}/releases/";
153 description = "Internet Routing Registry database server, processing IRR objects in the RPSL format";
154 license = lib.licenses.mit;
155 homepage = "https://github.com/irrdnet/irrd";
156 teams = [ lib.teams.wdz ];
157 };
158}