From 2fe6f096c93aa78624bf45d5e7239b7591bf3fd6 Mon Sep 17 00:00:00 2001 From: Dennis Wuitz Date: Tue, 11 Apr 2023 21:17:44 +0200 Subject: [PATCH 1/2] python3.pkgs.django-two-factor-auth: init at 1.15.1 --- .../django-two-factor-auth/default.nix | 64 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 66 insertions(+) create mode 100644 pkgs/development/python-modules/django-two-factor-auth/default.nix diff --git a/pkgs/development/python-modules/django-two-factor-auth/default.nix b/pkgs/development/python-modules/django-two-factor-auth/default.nix new file mode 100644 index 000000000000..a9006e07da13 --- /dev/null +++ b/pkgs/development/python-modules/django-two-factor-auth/default.nix @@ -0,0 +1,64 @@ +{ lib +, buildPythonPackage +, django +, django-formtools +, django-otp +, django-phonenumber-field +, fetchFromGitHub +, pydantic +, pythonOlder +, pythonRelaxDepsHook +, qrcode +, setuptools-scm +, twilio +, webauthn +}: + +buildPythonPackage rec { + pname = "django-two-factor-auth"; + version = "1.15.1"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "jazzband"; + repo = "django-two-factor-auth"; + rev = "refs/tags/${version}"; + hash = "sha256-+E6kSD00ChPiRLT2i43dNlVkbvuR1vKkbSZfD1Bf3qc="; + }; + + nativeBuildInputs = [ + pythonRelaxDepsHook + setuptools-scm + ]; + + pythonRelaxDeps = [ + "django-phonenumber-field" + ]; + + propagatedBuildInputs = [ + django + django-formtools + django-otp + # django-otp-yubikey #Addtional Pkgs not in nixpkgs yet + django-phonenumber-field + pydantic + qrcode + twilio + webauthn + ]; + + # require internet connection + doCheck = false; + + pythonImportsCheck = [ "two_factor" ]; + + meta = with lib; { + description = "Complete Two-Factor Authentication for Django"; + homepage = "https://github.com/jazzband/django-two-factor-auth"; + changelog = "https://github.com/jazzband/django-two-factor-auth/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ derdennisop ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c62e970ac92a..f51845dafd4c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2767,6 +2767,8 @@ self: super: with self; { django_treebeard = callPackage ../development/python-modules/django_treebeard { }; + django-two-factor-auth = callPackage ../development/python-modules/django-two-factor-auth { }; + django-versatileimagefield = callPackage ../development/python-modules/django-versatileimagefield { }; django-vite = callPackage ../development/python-modules/django-vite { }; From a602da1b892282fa636bed6c43b883225e692e9a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 16 Apr 2023 07:31:48 +0200 Subject: [PATCH 2/2] python310Packages.django-two-factor-auth: add optional-dependencies --- .../django-two-factor-auth/default.nix | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/django-two-factor-auth/default.nix b/pkgs/development/python-modules/django-two-factor-auth/default.nix index a9006e07da13..7ca684149800 100644 --- a/pkgs/development/python-modules/django-two-factor-auth/default.nix +++ b/pkgs/development/python-modules/django-two-factor-auth/default.nix @@ -5,6 +5,7 @@ , django-otp , django-phonenumber-field , fetchFromGitHub +, phonenumbers , pydantic , pythonOlder , pythonRelaxDepsHook @@ -41,18 +42,38 @@ buildPythonPackage rec { django django-formtools django-otp - # django-otp-yubikey #Addtional Pkgs not in nixpkgs yet django-phonenumber-field - pydantic qrcode - twilio - webauthn ]; - # require internet connection + passthru.optional-dependencies = { + call = [ + twilio + ]; + sms = [ + twilio + ]; + webauthn = [ + pydantic + webauthn + ]; + # yubikey = [ + # django-otp-yubikey + # ]; + phonenumbers = [ + phonenumbers + ]; + # phonenumberslite = [ + # phonenumberslite + # ]; + }; + + # Tests require internet connection doCheck = false; - pythonImportsCheck = [ "two_factor" ]; + pythonImportsCheck = [ + "two_factor" + ]; meta = with lib; { description = "Complete Two-Factor Authentication for Django";