Console Script Application

This commit is contained in:
2023-03-15 23:04:46 -04:00
parent ee29c54eef
commit ca09506e7d
5 changed files with 13 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
outputs = { self, nixpkgs, handyhelper }: let
system = "x86_64-linux";
handy_py = handyhelper.packages.${system}.handyhelper_pkg;
handy_py = handyhelper.packages.${system}.handyhelper;
in {
nixosConfigurations."staging" = nixpkgs.lib.nixosSystem {
inherit system;
@@ -16,13 +16,9 @@
wantedBy = ["networking-online.target"];
enable = true;
serviceConfig = {
ExecStart = let
python = pkgs.python3.withPackages (p: with p; [
handy_py
openai
]);
in
"${python.interpreter} -m handyhelper";
ExecStart = ''
${handy_py}/bin/handyhelper
'';
};
};
})

View File

@@ -22,7 +22,7 @@
handyhelper = pkgs.runCommand "Handy Helper Deploy" {
nativeBuildInputs = [
packages.handyhelper_pkg
packages.handyhelper
];
} ''
cat << 'DOC' >> $out
@@ -46,7 +46,6 @@ DOC
packages = {
handyhelper = mkPoetryApplication { projectDir = self; };
handyhelper_pkg = mkPoetryPackages { projectDir = self; };
default = self.packages.${system}.handyhelper;
};

View File

@@ -1 +1,2 @@
# Handle major modules of package
import * from ./__main__

View File

@@ -16,8 +16,10 @@ async def summarize(
):
print("Will summarize article.")
# TODO: Import bot token from env
bot.run(os.environ["DISCORD_TOKEN"],)
def main():
# TODO: Import bot token from env
bot.run(os.environ["DISCORD_TOKEN"])
if __name__ == "__main__":
print("Handy Helper has Begun!")

View File

@@ -6,6 +6,9 @@ authors = ["David Crompton"]
license = "MIT"
readme = "README.md"
[tool.poetry.scripts]
handyhelper = "handyhelper:main"
[tool.poetry.dependencies]
python = "^3.10"
requests = "^2.28.2"