I am new to Nix and trying to implement a service which passes Python Flask web services though Nginx proxy_pass
. This is what I have tried so far.
with import <nixpkgs> {};
let
buildInputs = [
nginx
python35Packages.python
python35Packages.flask
python35Packages.pyyaml
];
installPhase = ''
mkdir -p $out/pynix
cp -rv src config.yml $out/pynix
cd $out/pynix && nohup python src/main.py &> log.txt
'';
in {
network.description = "Local machine";
webserver = {
deployment = {
targetEnv = "virtualbox";
virtualbox.memorySize = 1024;
};
services = {
nginx = {
enable = true;
config = '';
http {
include ${nginx}/conf/mime.types;
server_name localhost;
location / {
proxy_pass http://localhost:5000;
}
}
'';
};
};
};
}
src/main.py
is a Python Flask service running on port 5000. How can I achieve this web service up and running when I do nixops deploy -d DEPLOYMENT_NAME
? Please help.