summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/strawberry-django/default.nix
blob: b5abd44e5a9bee13ba7f967ead62447a5210690a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  poetry-core,
  setuptools,

  # dependencies
  asgiref,
  django,
  strawberry-graphql,

  # optional-dependencies
  django-debug-toolbar,
  django-choices-field,

  # check inputs
  pytestCheckHook,
  django-guardian,
  django-model-utils,
  django-mptt,
  django-polymorphic,
  django-tree-queries,
  factory-boy,
  pillow,
  psycopg2,
  pytest-asyncio,
  pytest-cov-stub,
  pytest-django,
  pytest-mock,
  pytest-snapshot,
}:

buildPythonPackage rec {
  pname = "strawberry-django";
  version = "0.65.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "strawberry-graphql";
    repo = "strawberry-django";
    tag = "v${version}";
    hash = "sha256-cX/eG6qWe/h9U4p1pMhhI+bZ5pLmiwGeYxNthKvdI6o=";
  };

  postPatch = ''
    # django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the required STATIC_URL setting.
    echo 'STATIC_URL = "static/"' >> tests/django_settings.py
  '';

  build-system = [
    poetry-core
    setuptools
  ];

  dependencies = [
    django
    asgiref
    strawberry-graphql
  ];

  optional-dependencies = {
    debug-toolbar = [ django-debug-toolbar ];
    enum = [ django-choices-field ];
  };

  nativeCheckInputs = [
    pytestCheckHook

    django-guardian
    django-model-utils
    django-mptt
    django-polymorphic
    django-tree-queries
    factory-boy
    pillow
    psycopg2
    pytest-asyncio
    pytest-cov-stub
    pytest-django
    pytest-mock
    pytest-snapshot
  ]
  ++ optional-dependencies.debug-toolbar
  ++ optional-dependencies.enum;

  pythonImportsCheck = [ "strawberry_django" ];

  meta = {
    description = "Strawberry GraphQL Django extension";
    homepage = "https://github.com/strawberry-graphql/strawberry-django";
    changelog = "https://github.com/strawberry-graphql/strawberry-django/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ minijackson ];
  };
}