get some more dependencies into the derivation

This commit is contained in:
Michael Zhang 2021-09-22 01:51:06 -05:00
parent ede6d28cf6
commit d1e9e85540
No known key found for this signature in database
GPG Key ID: BDA47A31A3C8EE6B
6 changed files with 70 additions and 8 deletions

2
filestore/.ignore Normal file
View File

@ -0,0 +1,2 @@
/Cargo.nix
/crate-hashes.json

View File

@ -1,5 +1,5 @@
[run]
branch = True
source = easyctf
source = librectf
[report]

View File

@ -1,18 +1,33 @@
{ buildPythonApplication, nix-gitignore, python39Packages }:
{ buildPythonApplication, nix-gitignore, python39Packages, callPackage }:
let
dontCheck = p: p.overrideAttrs (a: {
setuptoolsCheckPhase = "true";
doCheck = false;
});
extraPypi = callPackage ./extra-pypi.nix {};
propagatedBuildInputs = with python39Packages; [
flask
flask-caching
flask_login
flask_wtf
markdown2
paramiko
passlib
pillow
pycryptodome
pyotp
raven
requests
email_validator
wtforms
pyqrcode
# TODO: figure out why these fail tests
(dontCheck flask_migrate)
];
] ++ (with extraPypi; [
wtforms-components
]);
checkInputs = with python39Packages; [
pytest
webtest

43
server/extra-pypi.nix Normal file
View File

@ -0,0 +1,43 @@
{ buildPythonPackage, fetchPypi, fetchFromGitHub, python39Packages }:
rec {
wtforms-components = buildPythonPackage rec {
pname = "WTForms-Components";
version = "0.10.5";
propagatedBuildInputs = with python39Packages; [
wtforms
email_validator
intervals
validators
];
doCheck = false;
src = fetchFromGitHub {
owner = "kvesteri";
repo = "wtforms-components";
rev = "0.10.5";
sha256 = "sha256-6Yu8dwuPQC+E1Irr8PdaeoR0kTOOSHV9rXXhDkTksgQ=";
};
};
intervals = buildPythonPackage rec {
pname = "intervals";
version = "0.9.2";
propagatedBuildInputs = with python39Packages; [ infinity ];
checkInputs = with python39Packages; [ pytest ];
src = fetchPypi {
inherit pname version;
sha256 = "sha256-x+5WjFg8qFfA2Rr22Q7l4Oit7z9WRtAHa/uHMFrkMJA=";
};
};
infinity = buildPythonPackage rec {
pname = "infinity";
version = "1.5";
propagatedBuildInputs = with python39Packages; [ ];
checkInputs = with python39Packages; [ pytest ];
src = fetchPypi {
inherit pname version;
sha256 = "sha256-jap8Fc4hAP3M/eISM34M1c8IWGn1TcJjS2ww1hRh7No=";
};
};
}

View File

@ -9,13 +9,13 @@ import traceback
from io import BytesIO, StringIO
from string import Template
import onetimepass
import paramiko
import yaml
from Crypto.PublicKey import RSA
from flask import current_app as app
from flask import url_for
from flask_login import current_user
from pyotp import TOTP
from markdown2 import markdown
from passlib.hash import bcrypt
from sqlalchemy import and_, func, select
@ -251,7 +251,9 @@ class User(db.Model):
)
def verify_totp(self, token):
return onetimepass.valid_totp(token, self.otp_secret)
totp = TOTP(self.otp_secret)
return totp.verify(token)
# return onetimepass.valid_totp(token, self.otp_secret)
@cache.memoize(timeout=120)
def points(self):

View File

@ -4,9 +4,9 @@ import tempfile
import pytest
from webtest import TestApp
from easyctf import create_app
from easyctf.config import Config
from easyctf.objects import db as _db
from librectf import create_app
from librectf.config import Config
from librectf.objects import db as _db
@pytest.yield_fixture(scope="function")