aboutsummaryrefslogtreecommitdiff
path: root/modules/authentik/authentik.nix
blob: 5b87de74e331896c1e7ffa58fe06def24fcfa41c (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
99
100
101
102
{ lib, stdenv, python3Packages, poetry, codespell, callPackage, ... }:

with python3Packages;

let
  server = callPackage ./authentik-server.nix { };
  web = callPackage ./authentik-web.nix { };
in
buildPythonPackage rec {
  pname = "authentik";
  version = "2023.8.3";

  format = "pyproject";
  src = pkgs.fetchFromGitHub {
    owner = "goauthentik";
    repo = pname;
    rev = "version/${version}";
    hash = "sha256-dpGvxhA5NWO8LKrGXzalV9EVn/nUIj6sMy2HdY5tjlM=";
  };

  patches = [ ./pyproject.diff ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "psycopg2-binary" "psycopg2"

    substituteInPlace lifecycle/ak \
      --replace "python -m manage" "${placeholder "out"}/bin/manage.py"
    patchShebangs lifecycle/ak
  '';

  postInstall = ''
    cp -a ./lifecycle $out/${python.sitePackages}
    cp -a ./lifecycle/gunicorn.conf.py $out/bin/gunicorn.py
    chmod +x $out/bin/gunicorn.py
    cp -a ./manage.py $out/bin/manage.py
  '';

  passthru.proxy = callPackage ./authentik-outpost-proxy.nix { };

  propagatedBuildInputs = [
    poetry
    poetry-core

    psycopg2
    argon2-cffi
    celery
    channels
    channels-redis
    codespell
    colorama
    dacite
    deepmerge
    defusedxml
    django
    django-filter
    django-guardian
    django-model-utils
    django-otp
    django-prometheus
    django-redis
    djangorestframework
    djangorestframework-guardian
    docker
    drf-spectacular
    duo-client
    facebook-sdk
    flower
    geoip2
    gunicorn
    kubernetes
    ldap3
    lxml
    opencontainers
    packaging
    paramiko
    psycopg
    pycryptodome
    pydantic
    pydantic-scim
    pyjwt
    pyyaml
    requests-oauthlib
    sentry-sdk
    service-identity
    structlog
    swagger-spec-validator
    twilio
    twisted
    ua-parser
    urllib3
    uvicorn
    watchdog
    webauthn
    wsproto
    xmlsec
    zxcvbn
    jsonpatch
  ]
  ++ channels.optional-dependencies.daphne
  ++ uvicorn.optional-dependencies.standard;
}