nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, apsw
3, buildPythonPackage
4, cython
5, fetchFromGitHub
6, flask
7, python
8, sqlite
9, withMysql ? false
10, mysql-connector
11, withPostgres ? false
12, psycopg2
13}:
14
15buildPythonPackage rec {
16 pname = "peewee";
17 version = "3.14.10";
18 format = "setuptools";
19
20 src = fetchFromGitHub {
21 owner = "coleifer";
22 repo = pname;
23 rev = version;
24 hash = "sha256-k3kKAImE1aVlmsSPXpaIkAVspAsAo5Hz6/n7u6+zTzA=";
25 };
26
27 buildInputs = [
28 sqlite
29 cython
30 ];
31
32 propagatedBuildInputs = [
33 apsw
34 ] ++ lib.optional withPostgres [
35 psycopg2
36 ] ++ lib.optional withMysql [
37 mysql-connector
38 ];
39
40 checkInputs = [
41 flask
42 ];
43
44 doCheck = withPostgres;
45
46 checkPhase = ''
47 rm -r playhouse # avoid using the folder in the cwd
48 ${python.interpreter} runtests.py
49 '';
50
51 pythonImportsCheck = [
52 "peewee"
53 ];
54
55 meta = with lib; {
56 description = "Python ORM with support for various database implementation";
57 homepage = "http://peewee-orm.com";
58 license = licenses.mit;
59 maintainers = with maintainers; [ ];
60 };
61}