2023-04-02 12:06:56 +00:00
|
|
|
{ depot, src, pkgs, lib, ... }:
|
2022-05-12 22:55:10 +00:00
|
|
|
|
|
|
|
let
|
2022-10-03 02:15:58 +00:00
|
|
|
inherit (pkgs) poetry2nix;
|
2022-08-14 20:01:26 +00:00
|
|
|
pyproject = pkgs.runCommand "authentik-pyproject" { src = "${src}/pyproject.toml"; } ''
|
|
|
|
sed 's/extras = \["standard"\],//' $src > $out
|
|
|
|
'';
|
|
|
|
poetrylock = pkgs.runCommand "authentik-poetrylock" { src = "${src}/poetry.lock"; } ''
|
|
|
|
sed -e 's/, markers = "extra == \\\"standard\\\""//' \
|
|
|
|
-e 's/and extra == \\\"standard\\\"//' \
|
|
|
|
$src > $out
|
|
|
|
'';
|
|
|
|
fixedSrc = pkgs.runCommand "authentik-src" { inherit src; } ''
|
|
|
|
cp -R $src $out
|
|
|
|
chmod -R u+w $out
|
|
|
|
cp ${pyproject} $out/pyproject.toml
|
|
|
|
cp ${poetrylock} $out/poetry.lock
|
|
|
|
'';
|
2022-10-03 02:15:58 +00:00
|
|
|
app = poetry2nix.mkPoetryApplication rec {
|
2022-08-14 20:01:26 +00:00
|
|
|
projectDir = fixedSrc;
|
2022-12-04 02:30:53 +00:00
|
|
|
python = pkgs.python311;
|
2023-04-02 12:06:56 +00:00
|
|
|
overrides = let
|
|
|
|
assertVersion = pkg: wantVersion: lib.assertMsg (pkg.version == wantVersion) "${pkg.pname} (${pkg.version}) is different to what I expected (${wantVersion}); maybe remove the override?";
|
|
|
|
in poetry2nix.overrides.withDefaults (self: super: {
|
2023-01-09 02:26:47 +00:00
|
|
|
cython = super.cython.overridePythonAttrs (oldAttrs: rec {
|
|
|
|
version = "0.29.33";
|
|
|
|
src = self.fetchPypi {
|
|
|
|
pname = "Cython";
|
|
|
|
inherit version;
|
|
|
|
sha256 = "0si8f96kyk7ljrmjrffsjm4i8n5fs7q29nlmldjfjb2d9967ch2h";
|
|
|
|
};
|
|
|
|
patches = [ ./cython-trashcan.patch ./cython-disable-trashcan.patch ];
|
|
|
|
});
|
2022-12-04 02:30:53 +00:00
|
|
|
dumb-init = super.dumb-init.overridePythonAttrs (old: {
|
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ self.setuptools ];
|
|
|
|
});
|
2022-05-12 22:55:10 +00:00
|
|
|
click-didyoumean = super.click-didyoumean.overridePythonAttrs (old: {
|
2022-12-04 02:30:53 +00:00
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ self.poetry ];
|
|
|
|
});
|
|
|
|
bump2version = super.bump2version.overridePythonAttrs (old: {
|
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ self.setuptools ];
|
|
|
|
});
|
|
|
|
opencontainers = super.opencontainers.overridePythonAttrs (old: {
|
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ self.setuptools self.pytest-runner ];
|
2022-05-12 22:55:10 +00:00
|
|
|
});
|
|
|
|
xmlsec = super.xmlsec.overridePythonAttrs (old: {
|
2022-10-03 02:15:58 +00:00
|
|
|
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [ self.pkgconfig ];
|
2022-05-12 22:55:10 +00:00
|
|
|
buildInputs = (old.buildInputs or []) ++ [ pkgs.xmlsec pkgs.libxslt pkgs.libxml2 pkgs.libtool ];
|
|
|
|
});
|
2022-08-26 20:46:56 +00:00
|
|
|
mistune = super.mistune.overridePythonAttrs (old: rec {
|
|
|
|
version = "0.8.4";
|
|
|
|
src = self.fetchPypi {
|
|
|
|
inherit (old) pname;
|
|
|
|
inherit version;
|
|
|
|
sha256 = "59a3429db53c50b5c6bcc8a07f8848cb00d7dc8bdb431a4ab41920d201d4756e";
|
|
|
|
};
|
|
|
|
});
|
2022-12-04 02:30:53 +00:00
|
|
|
urllib3-secure-extra = super.urllib3-secure-extra.overridePythonAttrs (old: {
|
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ self.flit-core ];
|
2022-08-14 20:01:26 +00:00
|
|
|
});
|
2023-02-11 18:03:35 +00:00
|
|
|
watchfiles = self.callPackage ../../../../third_party/nixpkgs/pkgs/development/python-modules/watchfiles/default.nix { CoreServices = null; };
|
2023-03-02 21:11:10 +00:00
|
|
|
|
2023-04-02 12:06:56 +00:00
|
|
|
kombu = assert assertVersion super.kombu "5.2.4"; super.kombu.overridePythonAttrs (old: {
|
|
|
|
buildInputs = (old.buildInputs or []) ++ [ self.setuptools ];
|
|
|
|
postPatch = ''
|
|
|
|
${old.postPatch or ""}
|
|
|
|
substituteInPlace requirements/test.txt --replace "pytz>dev" "pytz"
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
isort = assert assertVersion super.isort "5.10.1"; super.isort.overridePythonAttrs (old: {
|
|
|
|
postPatch = ''
|
|
|
|
${old.postPatch or ""}
|
|
|
|
substituteInPlace pyproject.toml --replace "pip-shims<=0.3.4" "pip-shims"
|
|
|
|
'';
|
2023-03-02 21:11:10 +00:00
|
|
|
});
|
2022-05-12 22:55:10 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
buildInputs = [ pkgs.bash ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/authentik
|
|
|
|
touch $out/share/authentik/__init__.py
|
|
|
|
cp -r ${src}/xml $out/share/authentik/xml
|
|
|
|
cp -r ${src}/lifecycle $out/share/authentik/lifecycle
|
|
|
|
|
|
|
|
wrapProgram $out/bin/ak \
|
|
|
|
--prefix PYTHONPATH ':' "$out/share/authentik"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
app.dependencyEnv
|