aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/flake.nix b/flake.nix
index b8616f8..5f63359 100644
--- a/flake.nix
+++ b/flake.nix
@@ -31,6 +31,9 @@
31 develPackagesAndScripts = [ 31 develPackagesAndScripts = [
32 postgresql_13 # PostgreSQL server with the standard admin tools. 32 postgresql_13 # PostgreSQL server with the standard admin tools.
33 python.pkgs.ipython # Interactive Python REPL for experimenting. 33 python.pkgs.ipython # Interactive Python REPL for experimenting.
34 heroku # CLI for the Heroku hosting platform.
35 skopeo # Docker container upload utility.
36 pwgen # Simple random token generator.
34 37
35 # More pleasant alternative to psql, with colours and auto-completion. 38 # More pleasant alternative to psql, with colours and auto-completion.
36 # Custom configuration to suppress irrelevant warnings and messages. 39 # Custom configuration to suppress irrelevant warnings and messages.
@@ -92,7 +95,7 @@
92 95
93 in { 96 in {
94 97
95 packages = { 98 packages = rec {
96 # Minimal production server. 99 # Minimal production server.
97 # This includes only application files tracked by git. 100 # This includes only application files tracked by git.
98 # Using `gunicorn` on top of `uvicorn` is recommended for bigger loads. 101 # Using `gunicorn` on top of `uvicorn` is recommended for bigger loads.
@@ -100,6 +103,16 @@
100 cd ${./.} 103 cd ${./.}
101 ${pythonWithDependencies}/bin/uvicorn --app-dir app app:main "$@" 104 ${pythonWithDependencies}/bin/uvicorn --app-dir app app:main "$@"
102 ''; 105 '';
106
107 # Minimal docker image.
108 # The Heroku hosting service assigns the `$PORT` dynamically.
109 docker = dockerTools.streamLayeredImage {
110 maxLayers = 2;
111 name = "app-docker";
112 config.EntryPoint = writeShellScript "run.sh" ''
113 ${server} --host 0.0.0.0 --port $PORT
114 '';
115 };
103 }; 116 };
104 117
105 devShell = mkShell rec { 118 devShell = mkShell rec {