diff --git a/flake.nix b/flake.nix index 85eed24..c4f97e9 100644 --- a/flake.nix +++ b/flake.nix @@ -97,8 +97,7 @@ deploy-rs.lib; packages.x86_64-linux = - self.nixosConfigurations.parsons.config.hacc.websites.builders - // { inherit (pkgs) uffd-resolve-deps uffd; }; + pkgs; # self.nixosConfigurations.parsons.config.hacc.websites.builders; }; } diff --git a/pkgs/default.nix b/pkgs/default.nix index 259c465..6d25aa3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -34,8 +34,7 @@ let ''; }; - inherit (callPackage ./uffd {}) uffd uffd-resolve-deps; - + uffd = callPackage ./uffd {}; netbox = pkgs.netbox.override (super: rec { python3 = super.python3.override (oldpy: { diff --git a/pkgs/dream2nix-packages/uffd/dream-lock.json b/pkgs/dream2nix-packages/uffd/dream-lock.json deleted file mode 100644 index ace849f..0000000 --- a/pkgs/dream2nix-packages/uffd/dream-lock.json +++ /dev/null @@ -1,268 +0,0 @@ -{ - "_generic": { - "defaultPackage": "uffd", - "invalidationHash": "f13e3aeb67851c0115478a1d91f70dedf5547c30dd10a1ebbb4a55e6630aa2b3", - "location": "", - "packages": { - "uffd": "2.1.0" - }, - "sourcesAggregatedHash": null, - "subsystem": "python" - }, - "_subsystem": { - "application": false, - "pythonAttr": "python310", - "sourceFormats": { - "Babel": "wheel", - "Click": "wheel", - "Flask": "wheel", - "Flask-SQLAlchemy": "sdist", - "Flask_Babel": "wheel", - "Flask_Migrate": "wheel", - "Jinja2": "wheel", - "Mako": "sdist", - "MarkupSafe": "sdist", - "SQLAlchemy": "sdist", - "Werkzeug": "wheel", - "alembic": "wheel", - "argon2_cffi": "wheel", - "asn1crypto": "wheel", - "certifi": "wheel", - "cffi": "wheel", - "chardet": "wheel", - "cryptography": "wheel", - "fido2": "sdist", - "idna": "wheel", - "itsdangerous": "sdist", - "oauthlib": "wheel", - "pyasn1": "wheel", - "pycparser": "sdist", - "python_dateutil": "wheel", - "python_editor": "wheel", - "qrcode": "wheel", - "requests": "wheel", - "requests_oauthlib": "wheel", - "six": "wheel", - "urllib3": "wheel" - } - }, - "sources": { - "Babel": { - "2.12.1": { - "hash": "sha256-tCRvt2d9O5j1AaOdQzltPK/cjq2wRfSjG+AYY/ZVxhA=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py3/B/Babel/Babel-2.12.1-py3-none-any.whl" - } - }, - "Click": { - "7.0": { - "hash": "sha256-IzUGXmOVueZ8pxbeX3Umc2v6bO6taQrfYW2SW9xiKxM=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/C/Click/Click-7.0-py2.py3-none-any.whl" - } - }, - "Flask": { - "1.0.2": { - "hash": "sha256-oIC3RLfjRcz8vHeVSGHLBbPGN4bpPys4deCRPUS0PwU=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/F/Flask/Flask-1.0.2-py2.py3-none-any.whl" - } - }, - "Flask-SQLAlchemy": { - "-": { - "hash": "sha256-xSRN5EzIXSJnEVYk2D+u8/no8Ih1Z4hpTzBaXVrRN8U=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/F/Flask-SQLAlchemy/Flask-SQLAlchemy-2.1.tar.gz" - } - }, - "Flask_Babel": { - "0.11.2": { - "hash": "sha256-Rio8WZsMz0JsoXV8xhLx2zg4RO/TRtFBcNoEyMdt1SE=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/2.7/F/Flask_Babel/Flask_Babel-0.11.2-py2.py3-none-any.whl" - } - }, - "Flask_Migrate": { - "2.1.1": { - "hash": "sha256-ST+bN5WYW5tJFb87fRaUZpfwJ7c1RThOfZ46efmJ0v4=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/3.6/F/Flask_Migrate/Flask_Migrate-2.1.1-py2.py3-none-any.whl" - } - }, - "Jinja2": { - "2.10": { - "hash": "sha256-dMk1obi7mjlHxQpUdmqWnUhGKQ4eeI6kTBOSFjcjw70=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/J/Jinja2/Jinja2-2.10-py2.py3-none-any.whl" - } - }, - "Mako": { - "-": { - "hash": "sha256-TgL95XvUq7XsQAGB5MMU9WrD5Juk+4sNULuhjLJ9Ja4=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/M/Mako/Mako-1.0.7.tar.gz" - } - }, - "MarkupSafe": { - "-": { - "hash": "sha256-TpczLJzkRLDCw43SLdxhx0PrII2RbkJloqO1db3MsdM=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/M/MarkupSafe/MarkupSafe-1.1.0.tar.gz" - } - }, - "SQLAlchemy": { - "-": { - "hash": "sha256-gCf6GD9b5GYDBhekl7LWTg4WyNYV5aNL35+rb2a/RyM=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/S/SQLAlchemy/SQLAlchemy-1.2.18.tar.gz" - } - }, - "Werkzeug": { - "0.14.1": { - "hash": "sha256-1dpzc1KTVY6xZR7i/dxNDe3PoGU4uIE6LiABFYPJ5Js=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/W/Werkzeug/Werkzeug-0.14.1-py2.py3-none-any.whl" - } - }, - "alembic": { - "1.0.0": { - "hash": "sha256-6325tFEFYuw3yR0AsA2V/eB2wQMNP2Ya6ogu7FMrNWU=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/a/alembic/alembic-1.0.0-py2.py3-none-any.whl" - } - }, - "argon2_cffi": { - "18.3.0": { - "hash": "sha256-Pdzd4EfNTborzOfYkNzv1nI1SLhJ+oK6h+BKRoB5ubE=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/cp34/a/argon2_cffi/argon2_cffi-18.3.0-cp34-abi3-manylinux1_x86_64.whl" - } - }, - "asn1crypto": { - "1.5.1": { - "hash": "sha256-205AcotyhQiRLLs9RPGc4YjyGOnrpjWCG7S2hWT4/Wc=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/a/asn1crypto/asn1crypto-1.5.1-py2.py3-none-any.whl" - } - }, - "certifi": { - "2018.8.24": { - "hash": "sha256-RWBIx+NxwInQp3pSEvs3osLc4eJBRuO34CYXNqrqoio=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/c/certifi/certifi-2018.8.24-py2.py3-none-any.whl" - } - }, - "cffi": { - "1.15.1": { - "hash": "sha256-3YbAhfri79SKyR3XzP/PwFcTh/4Rk9M7Y5TbfvMf4qQ=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/cp310/c/cffi/cffi-1.15.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" - } - }, - "chardet": { - "3.0.4": { - "hash": "sha256-/DI//K6u0OCgK/TRF3V7mK7VMNntRTHj4VRgEkwQZpE=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/c/chardet/chardet-3.0.4-py2.py3-none-any.whl" - } - }, - "cryptography": { - "2.6.1": { - "hash": "sha256-RaT0z09OalXIEo+LdrTAVwJ7J9TGfj/hV/oC8n43gw0=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/cp34/c/cryptography/cryptography-2.6.1-cp34-abi3-manylinux1_x86_64.whl" - } - }, - "fido2": { - "-": { - "hash": "sha256-41bE4v8Tainqfwv4LmecIlH7JGxNRZw8kfhLk69oiN4=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/f/fido2/fido2-0.5.0.tar.gz" - } - }, - "idna": { - "2.6": { - "hash": "sha256-jHMJxxj5SzpiXLZIrOMgFXrRb/ExrgrzYsnyG4DvbsQ=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/i/idna/idna-2.6-py2.py3-none-any.whl" - } - }, - "itsdangerous": { - "-": { - "hash": "sha256-y7P8+NPjPfhhcJ7K+J2eZinP8KIXvChI8bQc0w02BRk=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/i/itsdangerous/itsdangerous-0.24.tar.gz" - } - }, - "oauthlib": { - "2.1.0": { - "hash": "sha256-2IOzayGmrYE5U4A+36VjsbV515ynWP6VDRvJ6LMmAls=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/o/oauthlib/oauthlib-2.1.0-py2.py3-none-any.whl" - } - }, - "pyasn1": { - "0.4.2": { - "hash": "sha256-1c1u2ZXboW+tDFIc/jHNLWhAC1P8wrzpMyaCm+c6ttE=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/p/pyasn1/pyasn1-0.4.2-py2.py3-none-any.whl" - } - }, - "pycparser": { - "-": { - "hash": "sha256-qYhxir+tgLaxV6zOe/Ewowh20nYDc4rDnxQJkyRrJbM=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/source/p/pycparser/pycparser-2.19.tar.gz" - } - }, - "python_dateutil": { - "2.7.3": { - "hash": "sha256-GtuA56eCwS5S75qBgr6+tz8dfiTjdDl68G+0lWyNxcA=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/p/python_dateutil/python_dateutil-2.7.3-py2.py3-none-any.whl" - } - }, - "python_editor": { - "1.0.4": { - "hash": "sha256-G/boYKitUqFMPuElLV3CWyAwYY7YDAIlmPABdq3INn0=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py3/p/python_editor/python_editor-1.0.4-py3-none-any.whl" - } - }, - "qrcode": { - "6.1": { - "hash": "sha256-OZbuVg/DlTKRBgNwTIKYD/bU1dYp+cPyXzQXTOhgbPU=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/q/qrcode/qrcode-6.1-py2.py3-none-any.whl" - } - }, - "requests": { - "2.21.0": { - "hash": "sha256-e/KneFdtglYAAwoRDzwOPo7cUd+q/hwUbjmiAneElXs=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/r/requests/requests-2.21.0-py2.py3-none-any.whl" - } - }, - "requests_oauthlib": { - "1.0.0": { - "hash": "sha256-4hIy4kZYCMDokuDk27jC+q/sFqxtwGfdVG6bRm896sg=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/r/requests_oauthlib/requests_oauthlib-1.0.0-py2.py3-none-any.whl" - } - }, - "six": { - "1.12.0": { - "hash": "sha256-M1CAnwVVsR9VJEgzDQtS1fJMkaMi6koV7yJil0Dzdhw=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/s/six/six-1.12.0-py2.py3-none-any.whl" - } - }, - "urllib3": { - "1.24.1": { - "hash": "sha256-Yb8pyto/wvvvrU/fBZ6kvRtKhtK20V4cfAtYK5dS/jk=", - "type": "http", - "url": "https://files.pythonhosted.org/packages/py2.py3/u/urllib3/urllib3-1.24.1-py2.py3-none-any.whl" - } - } - } -} diff --git a/pkgs/uffd/0001-change-version-name.patch b/pkgs/uffd/0001-change-version-name.patch deleted file mode 100644 index 847ab77..0000000 --- a/pkgs/uffd/0001-change-version-name.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 6ed79db8267854a8fccab5f9191d997b5011211a Mon Sep 17 00:00:00 2001 -From: stuebinm -Date: Tue, 18 Jul 2023 18:26:44 +0200 -Subject: [PATCH] change version name - ---- - setup.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/setup.py b/setup.py -index 45f8ca6..40c1c74 100644 ---- a/setup.py -+++ b/setup.py -@@ -7,7 +7,7 @@ with open('README.md', 'r', encoding='utf-8') as f: - - setup( - name='uffd', -- version=os.environ.get('PACKAGE_VERSION', 'local'), -+ version=os.environ.get('PACKAGE_VERSION', '2.1.0'), - description='Web-based user management and single sign-on software', - long_description=long_description, - long_description_content_type='text/markdown', --- -2.40.1 - diff --git a/pkgs/uffd/default.nix b/pkgs/uffd/default.nix index 2743f80..45801e4 100644 --- a/pkgs/uffd/default.nix +++ b/pkgs/uffd/default.nix @@ -1,42 +1,35 @@ -{ fetchFromGitHub, fetchzip, pkgs }: +{ stdenv, lib, python3Packages, fetchzip }: -# slightly cursed, but possibly better than the previous packaging. -# dream2nix is not used via flakes because it has weirdly many dependencies -# -# to update uffd's dependencies, do run the `resolve` output of the below derivation +python3Packages.buildPythonPackage rec { + pname = "uffd"; + version = "2.0.1"; + PACKAGE_VERSION = version; -let - dream2nix = import (fetchFromGitHub { - owner = "nix-community"; - repo = "dream2nix"; - rev = "548ced938de2b007f40a3dc3e5d156ff58555cdc"; - sha256 = - "sha256-FaeGth9m9k5QGsQfg+iY0CuRNyy5lSM06u1Mra5bO/M="; # pkgs.lib.fakeSha256; - }); - d2n = dream2nix.lib.init { - inherit pkgs; - config.projectRoot = ./..; - }; src = fetchzip { - url = "https://git.cccv.de/uffd/uffd/-/archive/v2.1.0/uffd-v2.1.0.tar.gz"; - hash = "sha256-OIsaMxzrVW4ATxbaetlNlCwXsnycun1i3wdzTg1EHN0="; - postFetch = '' - sed -i -e 's/local/2.1.0/g' $out/setup.py - ''; + url = "https://git.cccv.de/uffd/uffd/-/archive/v${version}/uffd-v${version}.tar.gz"; + hash = "sha256-KP4J1bw5u7MklaPu2SBFRNyGgkKOBOpft5MMH+em5M4="; }; - outputs = d2n.dream2nix-interface.makeOutputs { - discoveredProjects = [{ - name = "uffd"; - relPath = ""; - subsystem = "python"; - translator = "pip"; - translators = [ "pip" ]; - subsystemInfo.pythonAttr = "python3"; - dreamLockPath = "./dream2nix-packages/uffd/dream-lock.json"; - }]; - source = src; -}; -in { - uffd = outputs.packages.uffd; - uffd-resolve-deps = outputs.packages.uffd.resolve; + + patches = [ ./gitea-magic.patch ./fix-setuppy.patch ./fix-userinfo.patch ]; + + propagatedBuildInputs = with python3Packages; [ + flask + flask_sqlalchemy + flask_migrate + qrcode + fido2 + oauthlib + flask-babel + argon2_cffi + itsdangerous + alembic + Mako + ]; + + postPatch = '' + sed -i -e 's/==[0-9.]\+//g' setup.py + ''; + + doCheck = false; + doInstallCheck = false; } diff --git a/pkgs/uffd/fix-userinfo.patch b/pkgs/uffd/fix-userinfo.patch index f46dfa2..555d805 100644 --- a/pkgs/uffd/fix-userinfo.patch +++ b/pkgs/uffd/fix-userinfo.patch @@ -1,12 +1,10 @@ ---- a/uffd/views/oauth2.py 2022-04-30 20:39:53.825474990 +0000 -+++ b/uffd/views/oauth2.py 2022-04-30 20:40:12.632389377 +0000 -@@ -237,6 +237,9 @@ - id=service_user.user.unix_uid, - name=service_user.user.displayname, -+ full_name=service_user.user.displayname, - nickname=service_user.user.loginname, -+ username=service_user.user.loginname, -+ login=service_user.user.loginname, - email=service_user.email, - groups=[group.name for group in service_user.user.groups] +--- a/uffd/oauth2/views.py 2022-04-30 20:39:53.825474990 +0000 ++++ b/uffd/oauth2/views.py 2022-04-30 20:40:12.632389377 +0000 +@@ -234,6 +234,7 @@ + id=user.unix_uid, + name=user.displayname, + nickname=user.loginname, ++ username=user.loginname, + email=user.mail, + groups=[group.name for group in user.groups] )