2019-07-18 13:18:26 +00:00
|
|
|
{ lib
|
2019-07-19 01:09:16 +00:00
|
|
|
, stdenv
|
2021-07-09 08:20:32 +00:00
|
|
|
, python
|
2019-07-18 13:18:26 +00:00
|
|
|
, buildPythonPackage
|
2019-07-19 01:09:16 +00:00
|
|
|
, fetchFromGitHub
|
2019-07-18 13:18:26 +00:00
|
|
|
, alembic
|
2021-07-09 08:20:32 +00:00
|
|
|
, argcomplete
|
|
|
|
, attrs
|
|
|
|
, blinker
|
2019-11-15 21:14:25 +00:00
|
|
|
, cached-property
|
2021-07-09 08:20:32 +00:00
|
|
|
, cattrs
|
|
|
|
, clickclick
|
2019-11-15 21:14:25 +00:00
|
|
|
, colorlog
|
2019-07-18 13:18:26 +00:00
|
|
|
, croniter
|
2021-07-09 08:20:32 +00:00
|
|
|
, cryptography
|
2022-01-12 14:43:09 +00:00
|
|
|
, dataclasses
|
2019-07-18 13:18:26 +00:00
|
|
|
, dill
|
|
|
|
, flask
|
|
|
|
, flask_login
|
|
|
|
, flask_wtf
|
2022-01-12 14:43:09 +00:00
|
|
|
, flask-appbuilder
|
|
|
|
, flask-caching
|
2019-07-18 13:18:26 +00:00
|
|
|
, GitPython
|
2021-07-09 08:20:32 +00:00
|
|
|
, graphviz
|
2019-07-18 13:18:26 +00:00
|
|
|
, gunicorn
|
2021-07-09 08:20:32 +00:00
|
|
|
, httpx
|
2019-07-18 13:18:26 +00:00
|
|
|
, iso8601
|
2021-07-09 08:20:32 +00:00
|
|
|
, importlib-resources
|
|
|
|
, importlib-metadata
|
|
|
|
, inflection
|
|
|
|
, itsdangerous
|
2019-07-18 13:18:26 +00:00
|
|
|
, jinja2
|
2021-07-09 08:20:32 +00:00
|
|
|
, jsonschema
|
2019-11-15 21:14:25 +00:00
|
|
|
, lazy-object-proxy
|
2021-07-09 08:20:32 +00:00
|
|
|
, lockfile
|
2019-07-18 13:18:26 +00:00
|
|
|
, markdown
|
2021-07-09 08:20:32 +00:00
|
|
|
, markupsafe
|
|
|
|
, marshmallow-oneofschema
|
|
|
|
, numpy
|
|
|
|
, openapi-spec-validator
|
2019-07-18 13:18:26 +00:00
|
|
|
, pandas
|
|
|
|
, pendulum
|
|
|
|
, psutil
|
|
|
|
, pygments
|
2021-07-09 08:20:32 +00:00
|
|
|
, pyjwt
|
2019-07-18 13:18:26 +00:00
|
|
|
, python-daemon
|
|
|
|
, python-dateutil
|
2021-07-09 08:20:32 +00:00
|
|
|
, python-nvd3
|
|
|
|
, python-slugify
|
|
|
|
, python3-openid
|
2022-01-12 14:43:09 +00:00
|
|
|
, pythonOlder
|
2021-07-09 08:20:32 +00:00
|
|
|
, pyyaml
|
|
|
|
, rich
|
2019-07-18 13:18:26 +00:00
|
|
|
, setproctitle
|
|
|
|
, sqlalchemy
|
2021-07-09 08:20:32 +00:00
|
|
|
, sqlalchemy-jsonfield
|
|
|
|
, swagger-ui-bundle
|
2019-07-18 13:18:26 +00:00
|
|
|
, tabulate
|
|
|
|
, tenacity
|
2019-11-15 21:14:25 +00:00
|
|
|
, termcolor
|
2019-07-18 13:18:26 +00:00
|
|
|
, unicodecsv
|
2021-07-09 08:20:32 +00:00
|
|
|
, werkzeug
|
2021-11-20 00:33:39 +00:00
|
|
|
, pytestCheckHook
|
2021-07-09 08:20:32 +00:00
|
|
|
, freezegun
|
|
|
|
, mkYarnPackage
|
2019-07-18 13:18:26 +00:00
|
|
|
}:
|
2021-07-09 08:20:32 +00:00
|
|
|
let
|
2022-03-02 21:41:49 +00:00
|
|
|
version = "2.2.4";
|
2019-07-18 13:18:26 +00:00
|
|
|
|
2021-07-09 08:20:32 +00:00
|
|
|
airflow-src = fetchFromGitHub rec {
|
2019-07-19 01:09:16 +00:00
|
|
|
owner = "apache";
|
|
|
|
repo = "airflow";
|
|
|
|
rev = version;
|
2022-03-02 21:41:49 +00:00
|
|
|
sha256 = "sha256-JCcEgCq1sB8lBaeJy7QQbWU00sGAh5vUmJAptF8M9qo=";
|
2019-07-18 13:18:26 +00:00
|
|
|
};
|
|
|
|
|
2021-07-09 08:20:32 +00:00
|
|
|
# airflow bundles a web interface, which is built using webpack by an undocumented shell script in airflow's source tree.
|
|
|
|
# This replicates this shell script, fixing bugs in yarn.lock and package.json
|
|
|
|
|
|
|
|
airflow-frontend = mkYarnPackage {
|
|
|
|
name = "airflow-frontend";
|
|
|
|
|
|
|
|
src = "${airflow-src}/airflow/www";
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
|
|
|
|
distPhase = "true";
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
cp -r $node_modules node_modules
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
yarn --offline build
|
|
|
|
find package.json yarn.lock static/css static/js -type f | sort | xargs md5sum > static/dist/sum.md5
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/static/
|
|
|
|
cp -r static/dist $out/static
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "apache-airflow";
|
|
|
|
inherit version;
|
|
|
|
src = airflow-src;
|
2019-11-15 21:14:25 +00:00
|
|
|
|
2022-01-12 14:43:09 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
2019-07-18 13:18:26 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
alembic
|
2021-07-09 08:20:32 +00:00
|
|
|
argcomplete
|
|
|
|
attrs
|
|
|
|
blinker
|
2019-11-15 21:14:25 +00:00
|
|
|
cached-property
|
2021-07-09 08:20:32 +00:00
|
|
|
cattrs
|
|
|
|
clickclick
|
2019-11-15 21:14:25 +00:00
|
|
|
colorlog
|
2019-07-18 13:18:26 +00:00
|
|
|
croniter
|
2021-07-09 08:20:32 +00:00
|
|
|
cryptography
|
2019-07-18 13:18:26 +00:00
|
|
|
dill
|
|
|
|
flask
|
2019-11-15 21:14:25 +00:00
|
|
|
flask-appbuilder
|
2019-07-18 13:18:26 +00:00
|
|
|
flask-caching
|
|
|
|
flask_login
|
|
|
|
flask_wtf
|
|
|
|
GitPython
|
2021-07-09 08:20:32 +00:00
|
|
|
graphviz
|
2019-07-18 13:18:26 +00:00
|
|
|
gunicorn
|
2021-07-09 08:20:32 +00:00
|
|
|
httpx
|
2019-07-18 13:18:26 +00:00
|
|
|
iso8601
|
2021-07-09 08:20:32 +00:00
|
|
|
importlib-resources
|
|
|
|
inflection
|
|
|
|
itsdangerous
|
2019-07-18 13:18:26 +00:00
|
|
|
jinja2
|
2021-07-09 08:20:32 +00:00
|
|
|
jsonschema
|
2019-11-15 21:14:25 +00:00
|
|
|
lazy-object-proxy
|
2021-07-09 08:20:32 +00:00
|
|
|
lockfile
|
2019-07-18 13:18:26 +00:00
|
|
|
markdown
|
2021-07-09 08:20:32 +00:00
|
|
|
markupsafe
|
|
|
|
marshmallow-oneofschema
|
|
|
|
numpy
|
|
|
|
openapi-spec-validator
|
2019-07-18 13:18:26 +00:00
|
|
|
pandas
|
2019-11-15 21:14:25 +00:00
|
|
|
pendulum
|
2019-07-18 13:18:26 +00:00
|
|
|
psutil
|
|
|
|
pygments
|
2021-07-09 08:20:32 +00:00
|
|
|
pyjwt
|
2019-07-18 13:18:26 +00:00
|
|
|
python-daemon
|
|
|
|
python-dateutil
|
2021-07-09 08:20:32 +00:00
|
|
|
python-nvd3
|
|
|
|
python-slugify
|
|
|
|
python3-openid
|
|
|
|
pyyaml
|
|
|
|
rich
|
2019-07-18 13:18:26 +00:00
|
|
|
setproctitle
|
|
|
|
sqlalchemy
|
2021-07-09 08:20:32 +00:00
|
|
|
sqlalchemy-jsonfield
|
|
|
|
swagger-ui-bundle
|
2019-07-18 13:18:26 +00:00
|
|
|
tabulate
|
|
|
|
tenacity
|
2019-11-15 21:14:25 +00:00
|
|
|
termcolor
|
2019-07-18 13:18:26 +00:00
|
|
|
unicodecsv
|
2021-07-09 08:20:32 +00:00
|
|
|
werkzeug
|
2022-01-12 14:43:09 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
dataclasses
|
|
|
|
] ++ lib.optionals (pythonOlder "3.9") [
|
|
|
|
importlib-metadata
|
2021-07-09 08:20:32 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
airflow-frontend
|
2019-11-15 21:14:25 +00:00
|
|
|
];
|
2019-07-18 13:18:26 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
2021-07-09 08:20:32 +00:00
|
|
|
freezegun
|
2021-11-20 00:33:39 +00:00
|
|
|
pytestCheckHook
|
2019-07-18 13:18:26 +00:00
|
|
|
];
|
|
|
|
|
2021-07-09 08:20:32 +00:00
|
|
|
INSTALL_PROVIDERS_FROM_SOURCES = "true";
|
|
|
|
|
2019-07-18 13:18:26 +00:00
|
|
|
postPatch = ''
|
2021-07-09 08:20:32 +00:00
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "attrs>=20.0, <21.0" "attrs" \
|
|
|
|
--replace "cattrs~=1.1, <1.7.0" "cattrs" \
|
2022-01-12 14:43:09 +00:00
|
|
|
--replace "colorlog>=4.0.2, <6.0" "colorlog" \
|
|
|
|
--replace "croniter>=0.3.17, <1.1" "croniter" \
|
2021-07-09 08:20:32 +00:00
|
|
|
--replace "docutils<0.17" "docutils" \
|
2022-01-12 14:43:09 +00:00
|
|
|
--replace "flask-login>=0.3, <0.5" "flask-login" \
|
|
|
|
--replace "flask-wtf>=0.14.3, <0.15" "flask-wtf" \
|
|
|
|
--replace "flask>=1.1.0, <2.0" "flask" \
|
|
|
|
--replace "importlib_resources~=1.4" "importlib_resources" \
|
2021-10-08 00:43:23 +00:00
|
|
|
--replace "itsdangerous>=1.1.0, <2.0" "itsdangerous" \
|
2022-01-12 14:43:09 +00:00
|
|
|
--replace "markupsafe>=1.1.1, <2.0" "markupsafe" \
|
|
|
|
--replace "pyjwt<2" "pyjwt" \
|
2021-10-08 00:43:23 +00:00
|
|
|
--replace "python-slugify>=3.0.0,<5.0" "python-slugify" \
|
2022-01-12 14:43:09 +00:00
|
|
|
--replace "sqlalchemy_jsonfield~=1.0" "sqlalchemy-jsonfield" \
|
|
|
|
--replace "tenacity~=6.2.0" "tenacity" \
|
|
|
|
--replace "werkzeug~=1.0, >=1.0.1" "werkzeug"
|
2021-07-09 08:20:32 +00:00
|
|
|
|
|
|
|
substituteInPlace tests/core/test_core.py \
|
2020-03-28 01:05:53 +00:00
|
|
|
--replace "/bin/bash" "${stdenv.shell}"
|
2021-11-20 00:35:17 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Fix failing test on Hydra
|
|
|
|
substituteInPlace airflow/utils/db.py \
|
|
|
|
--replace "/tmp/sqlite_default.db" "$TMPDIR/sqlite_default.db"
|
2019-07-18 13:18:26 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-12 14:43:09 +00:00
|
|
|
# allow for gunicorn processes to have access to Python packages
|
|
|
|
makeWrapperArgs = [
|
|
|
|
"--prefix PYTHONPATH : $PYTHONPATH"
|
|
|
|
];
|
2020-05-11 20:15:27 +00:00
|
|
|
|
2021-11-20 00:33:39 +00:00
|
|
|
preCheck = ''
|
2022-01-12 14:43:09 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export AIRFLOW_HOME=$HOME
|
|
|
|
export AIRFLOW__CORE__UNIT_TEST_MODE=True
|
|
|
|
export AIRFLOW_DB="$HOME/airflow.db"
|
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
|
|
|
|
airflow version
|
|
|
|
airflow db init
|
|
|
|
airflow db reset -y
|
2021-07-09 08:20:32 +00:00
|
|
|
'';
|
|
|
|
|
2021-11-20 00:33:39 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/core/test_core.py"
|
|
|
|
];
|
|
|
|
|
2021-11-20 00:35:17 +00:00
|
|
|
disabledTests = lib.optionals stdenv.isDarwin [
|
2022-01-12 14:43:09 +00:00
|
|
|
"bash_operator_kill" # psutil.AccessDenied
|
2021-11-20 00:35:17 +00:00
|
|
|
];
|
|
|
|
|
2021-07-09 08:20:32 +00:00
|
|
|
postInstall = ''
|
|
|
|
cp -rv ${airflow-frontend}/static/dist $out/lib/${python.libPrefix}/site-packages/airflow/www/static
|
2019-07-18 13:18:26 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Programmatically author, schedule and monitor data pipelines";
|
2021-12-28 16:53:47 +00:00
|
|
|
homepage = "https://airflow.apache.org/";
|
2019-07-18 13:18:26 +00:00
|
|
|
license = licenses.asl20;
|
2020-06-05 01:15:58 +00:00
|
|
|
maintainers = with maintainers; [ bhipple costrouc ingenieroariel ];
|
2022-05-15 20:20:48 +00:00
|
|
|
# requires extremely outdated versions of multiple dependencies
|
|
|
|
broken = true;
|
2019-07-18 13:18:26 +00:00
|
|
|
};
|
|
|
|
}
|