-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ff53c89
Showing
10 changed files
with
615 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 2.4.0; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.4.0/direnvrc" "sha256-XQzUAvL6pysIJnRJyR7uVpmUSZfc7LSgWQwq/4mBr1U=" | ||
fi | ||
use flake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
*.pyc | ||
*.so | ||
__pycache__ | ||
.DS_Store | ||
.benchmarks | ||
.cache | ||
.coverage* | ||
.direnv | ||
.eggs | ||
.hypothesis | ||
.idea | ||
.mypy_cache | ||
.tox | ||
.venv | ||
*.egg-info | ||
build | ||
_build | ||
coverage.xml | ||
dist | ||
htmlcov | ||
pip-wheel-metadata | ||
image |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from datetime import datetime | ||
|
||
|
||
def app(environ, start_response): | ||
start_response("200 OK", []) | ||
return [str(datetime.now().replace(microsecond=0)).encode()] | ||
|
||
|
||
def main(): | ||
from wsgiref.simple_server import make_server | ||
|
||
with make_server("0.0.0.0", 8000, app) as httpd: | ||
print("Serving on port 8000...") | ||
try: | ||
httpd.serve_forever() | ||
except KeyboardInterrupt: | ||
print("Bye") |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
description = "hello"; | ||
|
||
# Flake inputs | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
mach-nix.url = "github:davhau/mach-nix"; | ||
}; | ||
|
||
# Flake outputs | ||
outputs = { self, nixpkgs, mach-nix, flake-utils, ... }: | ||
let | ||
pythonVersion = "python39"; | ||
in | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
mach = mach-nix.lib.${system}; | ||
|
||
pythonApp = mach.buildPythonApplication ./.; | ||
pythonAppEnv = mach.mkPython { | ||
python = pythonVersion; | ||
requirements = builtins.readFile ./requirements.txt; | ||
}; | ||
pythonAppImage = pkgs.dockerTools.buildLayeredImage { | ||
name = pythonApp.pname; | ||
contents = [ pythonApp ]; | ||
config.Cmd = [ "${pythonApp}/bin/main" ]; | ||
}; | ||
in | ||
rec | ||
{ | ||
packages = { | ||
image = pythonAppImage; | ||
pythonPkg = pythonApp; | ||
default = packages.pythonPkg; | ||
}; | ||
|
||
apps.default = { | ||
type = "app"; | ||
program = "${packages.pythonPkg}/bin/main"; | ||
}; | ||
|
||
devShells.default = pkgs.mkShellNoCC { | ||
packages = [ pythonAppEnv ]; | ||
shellHook = '' | ||
export PYTHONPATH="${pythonAppEnv}/bin/python" | ||
''; | ||
}; | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[metadata] | ||
name = hello-webapp | ||
version = 0.1 | ||
|
||
[options] | ||
packages = find: | ||
install_requires = | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
main = app:main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from setuptools import setup | ||
|
||
setup() |