Skip to content

Commit

Permalink
Add cognix.environment
Browse files Browse the repository at this point in the history
yorickvP committed Nov 25, 2023
1 parent 37da12f commit d301da2
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/cog-interface.nix
Original file line number Diff line number Diff line change
@@ -71,6 +71,10 @@ in
'';
description = "Commands to run after gathering all the files for the container /src dir";
};
environment = mkOption {
type = types.attrsOf types.anything;
default = {};
};
};
options.python-env = with lib; mkOption {
type = types.submoduleWith {
4 changes: 3 additions & 1 deletion modules/cog.nix
Original file line number Diff line number Diff line change
@@ -90,6 +90,8 @@ in {
"${config.paths.projectRoot}"
else "${config.paths.projectRoot}/${config.paths.package}";

cognix.environment.PYTHONUNBUFFERED = true;

dockerTools.streamLayeredImage = {
passthru.entirePackage = entirePackage;
# glibc.out is needed for gpu
@@ -105,7 +107,7 @@ in {
] ++ resolvedSystemPackages;
config = {
Entrypoint = [ "${pkgs.tini}/bin/tini" "--" ];
Env = [ "PYTHONUNBUFFERED=1" ];
Env = lib.mapAttrsToList (name: val: "${name}=${toString val}") config.cognix.environment;
EXPOSE = 5000;
CMD = [ "python" "-m" "cog.server.http" ];
WorkingDir = "/src";

0 comments on commit d301da2

Please sign in to comment.