summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 7a028d0423b12b4e36bfe364f84604b2cceb048e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  description = "slopbot - Zulip bot with stock price lookups and LLM replies";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};

      pythonEnv = pkgs.python3.withPackages (ps: [
        ps.zulip
        ps.yfinance
        ps.openai
        ps.requests
      ]);
    in
    {
      devShells.${system}.default = pkgs.mkShell {
        buildInputs = [ pythonEnv ];
        shellHook = ''
          echo "slopbot dev shell ready"
          echo "Run: python main.py"
        '';
      };

      packages.${system}.default = pkgs.writeShellScriptBin "slopbot" ''
        cd /home/ben/src/bsima/slopbot
        exec ${pythonEnv}/bin/python ${./main.py}
      '';
    };
}