refactor(python): use dedicated runtime environments
This commit is contained in:
@@ -4,6 +4,20 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: _prev: {
|
||||
heater_python = final.python314.withPackages (
|
||||
ps: with ps; [
|
||||
fastapi
|
||||
pydantic
|
||||
tinytuya
|
||||
typer
|
||||
uvicorn
|
||||
]
|
||||
);
|
||||
})
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 8124 ];
|
||||
|
||||
systemd.services.heater-api = {
|
||||
@@ -17,7 +31,7 @@
|
||||
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.my_python}/bin/python -m python.heater.main --host 0.0.0.0 --port 8124";
|
||||
ExecStart = "${pkgs.heater_python}/bin/python -m python.heater.main --host 0.0.0.0 --port 8124";
|
||||
EnvironmentFile = "/etc/heater.env";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
|
||||
@@ -23,6 +23,13 @@ let
|
||||
...
|
||||
}:
|
||||
let
|
||||
giteaAutomationPython = pkgs.python314.withPackages (
|
||||
ps: with ps; [
|
||||
httpx
|
||||
pydantic
|
||||
typer
|
||||
]
|
||||
);
|
||||
runnerConfigFile = (pkgs.formats.yaml { }).generate "gitea-runner.yaml" { };
|
||||
registerRunner = pkgs.writeShellApplication {
|
||||
name = "register-gitea-runner";
|
||||
@@ -96,8 +103,8 @@ let
|
||||
curl
|
||||
gawk
|
||||
gitMinimal
|
||||
giteaAutomationPython
|
||||
gnused
|
||||
my_python
|
||||
nix
|
||||
nixfmt
|
||||
nixos-rebuild
|
||||
|
||||
@@ -8,6 +8,22 @@ let
|
||||
stateDir = "${vars.services}/gems";
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: _prev: {
|
||||
gems_python = final.python314.withPackages (
|
||||
ps: with ps; [
|
||||
fastapi
|
||||
jinja2
|
||||
pydantic
|
||||
pydantic-settings
|
||||
python-multipart
|
||||
typer
|
||||
uvicorn
|
||||
]
|
||||
);
|
||||
})
|
||||
];
|
||||
|
||||
users.groups.gems = { };
|
||||
users.users.gems = {
|
||||
isSystemUser = true;
|
||||
@@ -36,7 +52,7 @@ in
|
||||
Type = "simple";
|
||||
User = "gems";
|
||||
Group = "gems";
|
||||
ExecStart = "${pkgs.my_python}/bin/python -m python.gems.main --host 0.0.0.0 --port 8002";
|
||||
ExecStart = "${pkgs.gems_python}/bin/python -m python.gems.main --host 0.0.0.0 --port 8002";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
StandardOutput = "journal";
|
||||
|
||||
Reference in New Issue
Block a user