···
7
+
, openapi-generator-cli
14
+
version = "2023.10.7";
16
+
src = fetchFromGitHub {
17
+
owner = "goauthentik";
19
+
rev = "version/${version}";
20
+
hash = "sha256-+1IdXRt28UZ2KTa0zsmjneNUOcutP99UUwqcYyVyqTI=";
24
+
description = "The authentication glue you need";
25
+
changelog = "https://github.com/goauthentik/authentik/releases/tag/version%2F${version}";
26
+
homepage = "https://goauthentik.io/";
27
+
license = licenses.mit;
28
+
platforms = platforms.linux;
29
+
maintainers = with maintainers; [ jvanbruegge ];
32
+
website = buildNpmPackage {
33
+
pname = "authentik-website";
34
+
inherit version src meta;
35
+
npmDepsHash = "sha256-4dgFxEvMnp+35nSQNsEchtN1qoS5X2KzEbLPvMnyR+k=";
37
+
NODE_ENV = "production";
38
+
NODE_OPTIONS = "--openssl-legacy-provider";
48
+
npmInstallFlags = [ "--include=dev" ];
49
+
npmBuildScript = "build-docs-only";
52
+
clientapi = stdenvNoCC.mkDerivation {
53
+
pname = "authentik-client-api";
54
+
inherit version src meta;
59
+
substituteInPlace ./scripts/api-ts-config.yaml \
60
+
--replace-fail '/local' "$(pwd)/"
63
+
nativeBuildInputs = [ openapi-generator-cli ];
66
+
openapi-generator-cli generate -i ./schema.yml \
67
+
-g typescript-fetch -o $out \
68
+
-c ./scripts/api-ts-config.yaml \
69
+
--additional-properties=npmVersion=${nodejs.pkgs.npm.version} \
70
+
--git-repo-id authentik --git-user-id goauthentik
75
+
webui = buildNpmPackage {
76
+
pname = "authentik-webui";
77
+
inherit version meta;
79
+
src = runCommand "authentik-webui-source" {} ''
80
+
mkdir -p $out/web/node_modules/@goauthentik/
81
+
cp -r ${src}/web $out/
82
+
ln -s ${src}/website $out/
83
+
ln -s ${clientapi} $out/web/node_modules/@goauthentik/api
85
+
npmDepsHash = "sha256-5aCKlArtoEijGqeYiY3zoV0Qo7/Xt5hSXbmy2uYZpok=";
94
+
cp -r dist $out/dist
95
+
cp -r authentik $out/authentik
99
+
NODE_ENV = "production";
100
+
NODE_OPTIONS = "--openssl-legacy-provider";
102
+
npmInstallFlags = [ "--include=dev" ];
105
+
python = python3.override {
107
+
packageOverrides = final: prev: {
108
+
authentik-django = prev.buildPythonPackage {
109
+
pname = "authentik-django";
110
+
inherit version src meta;
114
+
substituteInPlace authentik/root/settings.py \
115
+
--replace-fail 'Path(__file__).absolute().parent.parent.parent' "\"$out\""
116
+
substituteInPlace authentik/lib/default.yml \
117
+
--replace-fail '/blueprints' "$out/blueprints"
118
+
substituteInPlace pyproject.toml \
119
+
--replace-fail 'dumb-init = "*"' "" \
120
+
--replace-fail 'djangorestframework-guardian' 'djangorestframework-guardian2'
123
+
nativeBuildInputs = [ prev.poetry-core ];
125
+
propagatedBuildInputs = with prev; [
141
+
djangorestframework
142
+
djangorestframework-guardian2
166
+
swagger-spec-validator
185
+
mkdir -p $out/web $out/website
186
+
cp -r lifecycle manage.py $out/${prev.python.sitePackages}/
187
+
cp -r blueprints $out/
188
+
cp -r ${webui}/dist ${webui}/authentik $out/web/
189
+
cp -r ${website} $out/website/help
190
+
ln -s $out/${prev.python.sitePackages}/lifecycle $out/lifecycle
196
+
inherit (python.pkgs) authentik-django;
198
+
proxy = buildGoModule {
199
+
pname = "authentik-proxy";
200
+
inherit version src meta;
203
+
substituteInPlace internal/gounicorn/gounicorn.go \
204
+
--replace-fail './lifecycle' "${authentik-django}/lifecycle"
205
+
substituteInPlace web/static.go \
206
+
--replace-fail './web' "${authentik-django}/web"
207
+
substituteInPlace internal/web/static.go \
208
+
--replace-fail './web' "${authentik-django}/web"
213
+
vendorHash = "sha256-74rSuZrO5c7mjhHh0iQlJEkOslsFrcDb1aRXXC4RsUM=";
216
+
mv $out/bin/server $out/bin/authentik
219
+
subPackages = [ "cmd/server" ];
222
+
in stdenvNoCC.mkDerivation {
223
+
pname = "authentik";
224
+
inherit src version;
228
+
patchShebangs lifecycle/ak
230
+
# This causes issues in systemd services
231
+
substituteInPlace lifecycle/ak \
232
+
--replace-fail 'printf' '>&2 printf' \
233
+
--replace-fail '> /dev/stderr' ""
239
+
cp -r lifecycle/ak $out/bin/
241
+
wrapProgram $out/bin/ak \
242
+
--prefix PATH : ${lib.makeBinPath [ (python.withPackages (ps: [ps.authentik-django])) proxy ]} \
243
+
--set TMPDIR /dev/shm \
244
+
--set PYTHONDONTWRITEBYTECODE 1 \
245
+
--set PYTHONUNBUFFERED 1
246
+
runHook postInstall
249
+
nativeBuildInputs = [ makeWrapper ];
252
+
mainProgram = "ak";