feat(nix): Switch to nix-pkgs instead of local expressions

This commit is contained in:
Tom Hubrecht 2024-07-03 16:11:44 +02:00
parent 05ad9099b3
commit b1fe687cf4
8 changed files with 35 additions and 230 deletions

View file

@ -3,22 +3,39 @@
pkgs ? import sources.nixpkgs { },
}:
let
nix-pkgs = import sources.nix-pkgs {
inherit pkgs;
# Python 3.12 is required to have the correct SSL options for connecting with the legacy server
python3Pkgs = pkgs.python312.pkgs;
};
python3 = pkgs.python312.override {
packageOverrides = _: _: {
inherit (nix-pkgs)
django-browser-reload
django-bulma-forms
django-cas-server
loadcredential
;
};
};
in
{
devShell = pkgs.mkShell {
name = "cas-eleves.dev";
packages = [
# Python 3.12 is required to have the correct SSL options for connecting with the legacy server
(pkgs.python312.withPackages (ps: [
(python3.withPackages (ps: [
ps.django
ps.ipython
ps.ldap3
# Local packages
(ps.callPackage ./nix/django-browser-reload { })
(ps.callPackage ./nix/django-bulma-forms { })
(ps.callPackage ./nix/django-cas-server { })
(ps.callPackage ./nix/loadcredential { })
ps.django-browser-reload
ps.django-bulma-forms
ps.django-cas-server
ps.loadcredential
]))
pkgs.gettext

View file

@ -1,42 +0,0 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
wheel,
asgiref,
django,
}:
buildPythonPackage rec {
pname = "django-browser-reload";
version = "1.12.1";
pyproject = true;
src = fetchFromGitHub {
owner = "adamchainz";
repo = "django-browser-reload";
rev = version;
hash = "sha256-IDIkAl6YYI3isDvpzCtAu4fLSr2gbjEvVW+K1WBDPbo=";
};
nativeBuildInputs = [
setuptools
wheel
];
propagatedBuildInputs = [
asgiref
django
];
pythonImportsCheck = [ "django_browser_reload" ];
meta = with lib; {
description = "Automatically reload your browser in development";
homepage = "https://github.com/adamchainz/django-browser-reload";
changelog = "https://github.com/adamchainz/django-browser-reload/blob/${src.rev}/CHANGELOG.rst";
license = licenses.mit;
maintainers = [ ]; # with maintainers; [ thubrecht ];
};
}

View file

@ -1,36 +0,0 @@
{
lib,
buildPythonPackage,
fetchgit,
setuptools,
setuptools-scm,
wheel,
django,
}:
buildPythonPackage rec {
pname = "django-bulma-forms";
version = "0.1.4";
pyproject = true;
src = fetchgit {
url = "https://git.hubrecht.ovh/hubrecht/django-bulma-forms";
rev = "v${version}";
hash = "sha256-4KTMXx3YxDxB4/YH14pJnNYtpOGXeDmD+gcbrUHwD/w=";
};
nativeBuildInputs = [
setuptools
setuptools-scm
wheel
];
propagatedBuildInputs = [ django ];
meta = with lib; {
description = "";
homepage = "https://git.hubrecht.ovh/hubrecht/django-bulma-forms";
license = licenses.eupl12;
maintainers = [ ]; # with maintainers; [ thubrecht ];
};
}

View file

@ -1,20 +0,0 @@
diff --git a/cas_server/tests/test_utils.py b/cas_server/tests/test_utils.py
index d690724..73ee761 100644
--- a/cas_server/tests/test_utils.py
+++ b/cas_server/tests/test_utils.py
@@ -17,6 +17,7 @@ from django.db import connection
import six
import warnings
import datetime
+import pytest
from cas_server import utils
@@ -61,6 +62,7 @@ class CheckPasswordCase(TestCase):
)
)
+ @pytest.mark.skip(reason="crypt is broken somehow")
def test_crypt(self):
"""test the crypt auth method"""
salts = ["$6$UVVAQvrMyXMF3FF3", "aa"]

View file

@ -1,64 +0,0 @@
{
lib,
buildPythonPackage,
pytestCheckHook,
fetchFromGitHub,
setuptools,
wheel,
django,
lxml,
requests,
requests-futures,
six,
pytest-django,
pytest-env,
pytest-runner,
mock,
}:
buildPythonPackage rec {
pname = "django-cas-server";
version = "unstable-2024-04-13";
format = "pyproject";
src = fetchFromGitHub {
owner = "nitmir";
repo = "django-cas-server";
rev = "a04477d34eedba4fcc91f00a22689defd3f22a7f";
hash = "sha256-K6SKnYBiA1TrSdDSodYJoz1Bk20PsNo2g0dvs4XdmY0=";
};
patches = [ ./01-pytest.patch ];
nativeBuildInputs = [
setuptools
wheel
];
propagatedBuildInputs = [
django
lxml
requests
requests-futures
setuptools
six
];
nativeCheckInputs = [
mock
pytestCheckHook
pytest-django
pytest-env
pytest-runner
];
pythonImportsCheck = [ "cas_server" ];
meta = with lib; {
description = "A Django Central Authentication Service server implementing the CAS Protocol 3.0 Specification";
homepage = "https://github.com/nitmir/django-cas-server";
changelog = "https://github.com/nitmir/django-cas-server/blob/${src.rev}/CHANGELOG.rst";
license = licenses.gpl3Only;
maintainers = [ ];
};
}

View file

@ -1,34 +0,0 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
wheel,
}:
buildPythonPackage rec {
pname = "loadcredential";
version = "1.2";
pyproject = true;
src = fetchFromGitHub {
owner = "Tom-Hubrecht";
repo = "loadcredential";
rev = "v${version}";
hash = "sha256-rNWFD89h1p1jYWLcfzsa/w8nK3bR4aVJsUPx0UtZnIw=";
};
build-system = [
setuptools
wheel
];
pythonImportsCheck = [ "loadcredential" ];
meta = {
description = "A simple python package to read credentials passed through systemd's LoadCredential, with a fallback on env variables ";
homepage = "https://github.com/Tom-Hubrecht/loadcredential";
license = lib.licenses.mit;
maintainers = []; # with lib.maintainers; [ thubrecht ];
};
}

View file

@ -1,5 +1,16 @@
{
"pins": {
"nix-pkgs": {
"type": "Git",
"repository": {
"type": "Git",
"url": "https://git.hubrecht.ovh/hubrecht/nix-pkgs.git"
},
"branch": "main",
"revision": "aa1ecb224ff9c4d200c4d5b9d229d1315c0184f0",
"url": null,
"hash": "sha256-csAikAaQcr4RdOtOf7DMkOpBBB8w1vD+MPVZGBStMVM="
},
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",

View file

@ -1,27 +0,0 @@
backcall==0.1.0
certifi==2019.11.28
chardet==3.0.4
decorator==4.4.2
Django==2.1.15
idna==2.9
ipython==7.13.0
ipython-genutils==0.2.0
jedi==0.16.0
ldap3==2.7
lxml==4.5.0
parso==0.6.2
pexpect==4.8.0
pickleshare==0.7.5
prompt-toolkit==3.0.4
ptyprocess==0.6.0
pyasn1==0.4.8
Pygments==2.6.1
pytz==2019.3
requests==2.23.0
requests-futures==1.0.0
six==1.14.0
traitlets==4.3.3
urllib3==1.25.8
wcwidth==0.1.9
#django-cas-server==1.1.0
git+https://github.com/tobast/django-cas-server@fix_crypt_des