Merge pull request #109841 from zhaofengli/powerdns-admin
This commit is contained in:
commit
05c92a54d8
13 changed files with 1798 additions and 0 deletions
|
@ -10562,6 +10562,12 @@
|
|||
githubId = 1141948;
|
||||
name = "Zack Grannan";
|
||||
};
|
||||
zhaofengli = {
|
||||
email = "hello@zhaofeng.li";
|
||||
github = "zhaofengli";
|
||||
githubId = 2189609;
|
||||
name = "Zhaofeng Li";
|
||||
};
|
||||
zimbatm = {
|
||||
email = "zimbatm@zimbatm.com";
|
||||
github = "zimbatm";
|
||||
|
|
111
pkgs/applications/networking/powerdns-admin/default.nix
Normal file
111
pkgs/applications/networking/powerdns-admin/default.nix
Normal file
|
@ -0,0 +1,111 @@
|
|||
{ lib, stdenv, fetchFromGitHub, mkYarnPackage, writeText, python3Packages }:
|
||||
|
||||
let
|
||||
version = "0.2.3";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ngoduykhanh";
|
||||
repo = "PowerDNS-Admin";
|
||||
rev = "v${version}";
|
||||
sha256 = "16faz57d77mxkflkvwyi8gb9wvnq2vhw79b84v1fmqvxri1yaphw";
|
||||
};
|
||||
|
||||
pythonDeps = with python3Packages; [
|
||||
flask flask_assets flask_login flask_sqlalchemy flask_migrate flask-seasurf flask_mail flask-sslify
|
||||
mysqlclient sqlalchemy
|
||||
configobj bcrypt requests ldap pyotp qrcode dnspython_1
|
||||
gunicorn python3-saml pyopenssl pytz cssmin jsmin authlib bravado-core
|
||||
lima pytimeparse pyyaml
|
||||
];
|
||||
|
||||
assets = mkYarnPackage {
|
||||
inherit src version;
|
||||
packageJSON = ./package.json;
|
||||
yarnNix = ./yarndeps.nix;
|
||||
|
||||
nativeBuildInputs = pythonDeps;
|
||||
patchPhase = ''
|
||||
sed -i -r -e "s|'cssmin',\s?'cssrewrite'|'cssmin'|g" powerdnsadmin/assets.py
|
||||
'';
|
||||
buildPhase = ''
|
||||
# The build process expects the directory to be writable
|
||||
# with node_modules at a specific path
|
||||
# https://github.com/ngoduykhanh/PowerDNS-Admin/blob/master/.yarnrc
|
||||
|
||||
approot=deps/powerdns-admin-assets
|
||||
|
||||
ln -s $node_modules $approot/powerdnsadmin/static/node_modules
|
||||
FLASK_APP=$approot/powerdnsadmin/__init__.py flask assets build
|
||||
'';
|
||||
installPhase = ''
|
||||
# https://github.com/ngoduykhanh/PowerDNS-Admin/blob/54b257768f600c5548a1c7e50eac49c40df49f92/docker/Dockerfile#L43
|
||||
mkdir $out
|
||||
cp -r $approot/powerdnsadmin/static/{generated,assets,img} $out
|
||||
find $node_modules/icheck/skins/square -name '*.png' -exec cp {} $out/generated \;
|
||||
|
||||
mkdir $out/fonts
|
||||
cp $node_modules/ionicons/dist/fonts/* $out/fonts
|
||||
cp $node_modules/bootstrap/dist/fonts/* $out/fonts
|
||||
cp $node_modules/font-awesome/fonts/* $out/fonts
|
||||
'';
|
||||
distPhase = "true";
|
||||
};
|
||||
|
||||
assetsPy = writeText "assets.py" ''
|
||||
from flask_assets import Environment
|
||||
assets = Environment()
|
||||
assets.register('js_login', 'generated/login.js')
|
||||
assets.register('js_validation', 'generated/validation.js')
|
||||
assets.register('css_login', 'generated/login.css')
|
||||
assets.register('js_main', 'generated/main.js')
|
||||
assets.register('css_main', 'generated/main.css')
|
||||
'';
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "powerdns-admin";
|
||||
|
||||
inherit src version;
|
||||
|
||||
nativeBuildInputs = [ python3Packages.wrapPython ];
|
||||
|
||||
pythonPath = pythonDeps;
|
||||
|
||||
gunicornScript = ''
|
||||
#!/bin/sh
|
||||
if [ ! -z $CONFIG ]; then
|
||||
exec python -m gunicorn.app.wsgiapp "powerdnsadmin:create_app(config='$CONFIG')" "$@"
|
||||
fi
|
||||
|
||||
exec python -m gunicorn.app.wsgiapp "powerdnsadmin:create_app()" "$@"
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
rm -r powerdnsadmin/static powerdnsadmin/assets.py
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# Nasty hack: call wrapPythonPrograms to set program_PYTHONPATH (see tribler)
|
||||
wrapPythonPrograms
|
||||
|
||||
mkdir -p $out/share $out/bin
|
||||
cp -r powerdnsadmin $out/share/powerdnsadmin
|
||||
|
||||
ln -s ${assets} $out/share/powerdnsadmin/static
|
||||
ln -s ${assetsPy} $out/share/powerdnsadmin/assets.py
|
||||
|
||||
echo "$gunicornScript" > $out/bin/powerdns-admin
|
||||
chmod +x $out/bin/powerdns-admin
|
||||
wrapProgram $out/bin/powerdns-admin \
|
||||
--set PATH ${python3Packages.python}/bin \
|
||||
--set PYTHONPATH $out/share:$program_PYTHONPATH
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A PowerDNS web interface with advanced features";
|
||||
homepage = "https://github.com/ngoduykhanh/PowerDNS-Admin";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
16
pkgs/applications/networking/powerdns-admin/package.json
Normal file
16
pkgs/applications/networking/powerdns-admin/package.json
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"admin-lte": "2.4.9",
|
||||
"bootstrap": "^3.4.1",
|
||||
"bootstrap-validator": "^0.11.9",
|
||||
"datatables.net-plugins": "^1.10.19",
|
||||
"icheck": "^1.0.2",
|
||||
"jquery-slimscroll": "^1.3.8",
|
||||
"jquery-ui-dist": "^1.12.1",
|
||||
"jquery.quicksearch": "^2.4.0",
|
||||
"jtimeout": "^3.1.0",
|
||||
"multiselect": "^0.9.12"
|
||||
},
|
||||
"name": "powerdns-admin-assets",
|
||||
"version": "0.2.3"
|
||||
}
|
20
pkgs/applications/networking/powerdns-admin/update-asset-deps.sh
Executable file
20
pkgs/applications/networking/powerdns-admin/update-asset-deps.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../../../.. -i bash -p wget yarn2nix-moretea.yarn2nix jq
|
||||
|
||||
# This script is based upon:
|
||||
# pkgs/applications/networking/instant-messengers/riot/update-riot-desktop.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ $# -ne 1 || $1 == -* ]]; then
|
||||
echo "Regenerates the Yarn dependency lock files for the powerdns-admin package."
|
||||
echo "Usage: $0 <git release version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WEB_SRC="https://raw.githubusercontent.com/ngoduykhanh/PowerDNS-Admin/v$1"
|
||||
|
||||
wget "$WEB_SRC/package.json" -O - | jq ".name = \"powerdns-admin-assets\" | .version = \"$1\"" > package.json
|
||||
wget "$WEB_SRC/yarn.lock" -O yarn.lock
|
||||
yarn2nix --lockfile=yarn.lock > yarndeps.nix
|
||||
rm yarn.lock
|
1453
pkgs/applications/networking/powerdns-admin/yarndeps.nix
Normal file
1453
pkgs/applications/networking/powerdns-admin/yarndeps.nix
Normal file
File diff suppressed because it is too large
Load diff
25
pkgs/development/python-modules/flask-seasurf/default.nix
Normal file
25
pkgs/development/python-modules/flask-seasurf/default.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ lib, fetchFromGitHub, buildPythonPackage, isPy3k, flask }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Flask-SeaSurf";
|
||||
version = "0.3.0";
|
||||
disabled = !isPy3k;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "maxcountryman";
|
||||
repo = "flask-seasurf";
|
||||
rev = version;
|
||||
sha256 = "02hsvppsz1d93v641f14fdnd22gbc12ilc9k9kn7wl119n5s3pd8";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ flask ];
|
||||
|
||||
pythonImportsCheck = [ "flask_seasurf" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Flask extension for preventing cross-site request forgery";
|
||||
homepage = "https://github.com/maxcountryman/flask-seasurf";
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
23
pkgs/development/python-modules/flask-sslify/default.nix
Normal file
23
pkgs/development/python-modules/flask-sslify/default.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
{ lib, fetchPypi, buildPythonPackage, flask }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Flask-SSLify";
|
||||
version = "0.1.5";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0gjl1m828z5dm3c5dpc2qjgi4llf84cp72mafr0ib5fd14y1sgnk";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ flask ];
|
||||
|
||||
doCheck = false;
|
||||
pythonImportsCheck = [ "flask_sslify" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Flask extension that redirects all incoming requests to HTTPS";
|
||||
homepage = "https://github.com/kennethreitz42/flask-sslify";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
21
pkgs/development/python-modules/lima/default.nix
Normal file
21
pkgs/development/python-modules/lima/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ lib, buildPythonPackage, fetchPypi, isPy3k, pytestCheckHook }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "lima";
|
||||
version = "0.5";
|
||||
disabled = !isPy3k;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0qqj0053r77ppkcyyk2fhpaxjzsl1h98nf9clpny6cs66sdl241v";
|
||||
};
|
||||
|
||||
checkInputs = [ pytestCheckHook ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Lightweight Marshalling of Python 3 Objects.";
|
||||
homepage = "https://github.com/b6d/lima";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
40
pkgs/development/python-modules/python3-saml/default.nix
Normal file
40
pkgs/development/python-modules/python3-saml/default.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ lib, fetchurl, fetchFromGitHub, buildPythonPackage, isPy3k,
|
||||
isodate, lxml, xmlsec, freezegun }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "python3-saml";
|
||||
version = "1.10.1";
|
||||
disabled = !isPy3k;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "onelogin";
|
||||
repo = "python3-saml";
|
||||
rev = "v${version}";
|
||||
sha256 = "1yk02xq90bm7p6k091av6gapb5h2ccxzgrbm03sj2x8h0wff9s8k";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Remove the dependency on defusedxml
|
||||
#
|
||||
# This patch is already merged upstream and does not introduce any
|
||||
# functionality changes.
|
||||
(fetchurl {
|
||||
url = "https://github.com/onelogin/python3-saml/commit/4b6c4b1f2ed3f6eab70ff4391e595b808ace168c.patch";
|
||||
sha256 = "11gqn7ib2hmlx5wp4xhi375v5ajapwmj4lpw0y44bh5ww8cypvqy";
|
||||
})
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
isodate lxml xmlsec
|
||||
];
|
||||
|
||||
checkInputs = [ freezegun ];
|
||||
pythonImportsCheck = [ "onelogin.saml2" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "OneLogin's SAML Python Toolkit for Python 3";
|
||||
homepage = "https://github.com/onelogin/python3-saml";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
47
pkgs/development/python-modules/xmlsec/default.nix
Normal file
47
pkgs/development/python-modules/xmlsec/default.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
{ lib
|
||||
, fetchPypi
|
||||
, buildPythonPackage
|
||||
, pytestCheckHook
|
||||
, libxslt
|
||||
, libxml2
|
||||
, libtool
|
||||
, pkg-config
|
||||
, xmlsec
|
||||
, pkgconfig
|
||||
, setuptools-scm
|
||||
, toml
|
||||
, lxml
|
||||
, hypothesis
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "xmlsec";
|
||||
version = "1.3.9";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "1c4k42zv3plm6v65p7z6l5rxyf50h40d02nhc16vq7cjrfvdf4rx";
|
||||
};
|
||||
|
||||
# https://github.com/mehcode/python-xmlsec/issues/84#issuecomment-632930116
|
||||
patches = [
|
||||
./reset-lxml-in-tests.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config pkgconfig setuptools-scm toml ];
|
||||
|
||||
buildInputs = [ xmlsec libxslt libxml2 libtool ];
|
||||
|
||||
propagatedBuildInputs = [ lxml ];
|
||||
|
||||
# Full git clone required for test_doc_examples
|
||||
checkInputs = [ pytestCheckHook hypothesis ];
|
||||
disabledTestPaths = [ "tests/test_doc_examples.py" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python bindings for the XML Security Library";
|
||||
homepage = "https://github.com/mehcode/python-xmlsec";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/tests/base.py b/tests/base.py
|
||||
index b05de1d..5ec356f 100644
|
||||
--- a/tests/base.py
|
||||
+++ b/tests/base.py
|
||||
@@ -94,6 +94,7 @@ class TestMemoryLeaks(unittest.TestCase):
|
||||
|
||||
def load_xml(self, name, xpath=None):
|
||||
"""returns xml.etree"""
|
||||
+ etree.set_default_parser(parser=etree.XMLParser())
|
||||
root = etree.parse(self.path(name)).getroot()
|
||||
if xpath is None:
|
||||
return root
|
||||
diff --git a/tests/test_doc_examples.py b/tests/test_doc_examples.py
|
||||
index 2fc490f..53d2377 100644
|
||||
--- a/tests/test_doc_examples.py
|
||||
+++ b/tests/test_doc_examples.py
|
||||
@@ -42,3 +42,5 @@ def test_doc_example(example):
|
||||
"""
|
||||
with cd(example.parent):
|
||||
runpy.run_path(str(example))
|
||||
+ from lxml import etree
|
||||
+ etree.set_default_parser(parser=etree.XMLParser())
|
|
@ -20094,6 +20094,8 @@ in
|
|||
|
||||
powerdns = callPackage ../servers/dns/powerdns { };
|
||||
|
||||
powerdns-admin = callPackage ../applications/networking/powerdns-admin { };
|
||||
|
||||
dnsdist = callPackage ../servers/dns/dnsdist { };
|
||||
|
||||
pdns-recursor = callPackage ../servers/dns/pdns-recursor { };
|
||||
|
|
|
@ -2401,6 +2401,8 @@ in {
|
|||
|
||||
flask_script = callPackage ../development/python-modules/flask-script { };
|
||||
|
||||
flask-seasurf = callPackage ../development/python-modules/flask-seasurf { };
|
||||
|
||||
flask-silk = callPackage ../development/python-modules/flask-silk { };
|
||||
|
||||
flask-socketio = callPackage ../development/python-modules/flask-socketio { };
|
||||
|
@ -2409,6 +2411,8 @@ in {
|
|||
|
||||
flask_sqlalchemy = callPackage ../development/python-modules/flask-sqlalchemy { };
|
||||
|
||||
flask-sslify = callPackage ../development/python-modules/flask-sslify { };
|
||||
|
||||
flask-swagger = callPackage ../development/python-modules/flask-swagger { };
|
||||
|
||||
flask-swagger-ui = callPackage ../development/python-modules/flask-swagger-ui { };
|
||||
|
@ -3835,6 +3839,8 @@ in {
|
|||
|
||||
lightparam = callPackage ../development/python-modules/lightparam { };
|
||||
|
||||
lima = callPackage ../development/python-modules/lima { };
|
||||
|
||||
limitlessled = callPackage ../development/python-modules/limitlessled { };
|
||||
|
||||
limits = callPackage ../development/python-modules/limits { };
|
||||
|
@ -6402,6 +6408,8 @@ in {
|
|||
|
||||
python-awair = callPackage ../development/python-modules/python-awair { };
|
||||
|
||||
python3-saml = callPackage ../development/python-modules/python3-saml { };
|
||||
|
||||
python-axolotl = callPackage ../development/python-modules/python-axolotl { };
|
||||
|
||||
python-axolotl-curve25519 = callPackage ../development/python-modules/python-axolotl-curve25519 { };
|
||||
|
@ -8647,6 +8655,10 @@ in {
|
|||
|
||||
xmlschema = callPackage ../development/python-modules/xmlschema { };
|
||||
|
||||
xmlsec = callPackage ../development/python-modules/xmlsec {
|
||||
inherit (pkgs) libxslt libxml2 libtool pkg-config xmlsec;
|
||||
};
|
||||
|
||||
xmltodict = callPackage ../development/python-modules/xmltodict { };
|
||||
|
||||
xmodem = callPackage ../development/python-modules/xmodem { };
|
||||
|
|
Loading…
Reference in a new issue