From 12dd309b8e334eaf19eae6d9eb9bb85024457b8a Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 21 May 2026 13:09:59 -0400 Subject: Convert to nix flake; fix systemd service to use nix run - Add flake.nix with nixos-unstable nixpkgs, devShell and slopbot package - Add flake.lock - Update .envrc to 'use flake .' - Update slopbot.service: use 'nix run' instead of nix-shell, remove broken sandbox options (ProtectHome, InaccessiblePaths, ProtectSystem, ReadOnlyPaths, ReadWritePaths, PrivateTmp) that block nix store access - Delete shell.nix - Add 'result' to .gitignore - Restore openai to requirements.txt (was accidentally dropped) --- flake.nix | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 flake.nix (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7a028d0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,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} + ''; + }; +} -- cgit v1.2.3