-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
52 lines (43 loc) · 1.5 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "python-env";
buildInputs = [
python310
python310Packages.pip
python310Packages.virtualenv
postgresql
lighttpd
];
SOURCE_DATE_EPOCH = 315532800;
PROJDIR = "/tmp/python-dev";
shellHook = ''
echo "Using ${python310.name}"
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib"
[ ! -d '$PROJDIR' ] && virtualenv $PROJDIR && echo "SETUP python-dev: DONE"
source $PROJDIR/bin/activate
export LC_ALL=C
pip install 'apache-airflow==2.8.3' --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.8.3/constraints-3.10.txt"
pip install apache-airflow-providers-docker
pip install avmesos psycopg2 waitress
make install-dev
mkdir /tmp/airflow
mkdir /tmp/postgresql
mkdir /tmp/dags
mkdir /home/$USER/airflow
initdb -D /tmp/postgresql
cp docs/nixshell/pg_hba.conf /tmp/postgresql
pg_ctl -D /tmp/postgresql -l logfile -o "--unix_socket_directories='/tmp' --listen_addresses='*'" start
createuser -h /tmp -s airflow
createdb -h /tmp airflow -O airflow
cp docs/examples/airflow.cfg /home/$USER/airflow/
cp docs/examples/dags/* /tmp/dags/
cp docs/nixshell/lighttpd.conf /tmp/
airflow db migrate
airflow users create --username admin --role Admin -e [email protected] -f admin -l admin --password admin
# Webserver listen on 8881
lighttpd -f /tmp/lighttpd.conf
# airflow listen on 8880
nohup airflow webserver &
# airflow scheduler
'';
}