Skip to content

Instantly share code, notes, and snippets.

@mtn
Last active June 21, 2020 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtn/7be10e3a68207e43b7575b471a00c174 to your computer and use it in GitHub Desktop.
Save mtn/7be10e3a68207e43b7575b471a00c174 to your computer and use it in GitHub Desktop.
# Commented-out is a minimal example of what works, uncommented has an internal error
services.uwsgi.enable = true;
services.uwsgi.plugins = [ "python3" ];
# services.uwsgi.instance = {
# type = "emperor";
# vassals.hello = {
# type = "normal";
# master = true;
# workers = 2;
# http = ":8000";
# module = "wsgi:application";
# chdir = path/to/app;
# pythonPackages = self: with self; [ flask ];
# };
# };
services.uwsgi.instance = {
type = "emperor";
vassals.hello = {
type = "normal";
master = true;
workers = 2;
http = ":8000";
module = "wsgi:application";
chdir = path/to/app;
pythonPackages = self: with self; let
src = pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "poetry2nix";
rev = "e7c69a288c10e4d97816fdabda5ae3f38e21914e";
sha256 = "1sygililyh44igkj57ihyv1i0kjmj646nw80q1jrj9pvs8m97hgm";
};
in
with import "${src.out}/overlay.nix" pkgs pkgs;
[
poetry2nix.mkPoetryApplication {
projectDir = path/to/app;
}
];
};
};
with import <nixpkgs> {};
let
src = fetchFromGitHub {
owner = "nix-community";
repo = "poetry2nix";
rev = "e7c69a288c10e4d97816fdabda5ae3f38e21914e";
sha256 = "1sygililyh44igkj57ihyv1i0kjmj646nw80q1jrj9pvs8m97hgm";
};
in
with import "${src.out}/overlay.nix" pkgs pkgs;
let
pythonEnv = poetry2nix.mkPoetryEnv {
projectDir = ./.;
};
in
mkShell {
name = "dev-environment";
nativeBuildInputs = [
];
buildInputs = [
pythonEnv
pkgs.python37.pkgs.poetry
];
}
Jun 21 16:47:52 nixos uwsgi[21476]: --- no python application found, check your startup logs for errors ---
Jun 21 16:47:52 nixos uwsgi[21476]: [pid: 21483|app: -1|req: -1/3] 127.0.0.1 () {28 vars in 287 bytes} [Sun Jun 21 16:47:52 2020] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment