From 02a806624b8a66114192ac75ae4114a3c088b170 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 5 Jul 2022 11:39:55 -0400 Subject: Add setup and build info --- .gitignore | 2 ++ README | 40 ++++++++++++++++++++++++++++++++++++++++ default.nix | 13 +++++++++++++ dev.sh | 1 - setup.py | 8 ++++++++ 5 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 README create mode 100644 default.nix delete mode 100755 dev.sh create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e917d0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +*.egg-info* diff --git a/README b/README new file mode 100644 index 0000000..1980657 --- /dev/null +++ b/README @@ -0,0 +1,40 @@ +To develop, run: + + nix-shell + +For API setup instructions: + + twitter-bot --instructions + +To install and deploy: + + nix-build . + nix-env -i ./result + +Now you can copy the systemd unit file to `~/.config/systemd/user/` and enable: + + systemctl --user enable twitter-bot.service twitter-bot.timer + +Example systemd unit file: + + [Unit] + Description=Zulip Twitter Bot + + [Service] + Type=oneshot + ExecStart=/home/ben/.nix-profile/bin/twitter-bot --dry-run --stream investing --twitter-name michaeljburry + ExecStart=/home/ben/.nix-profile/bin/twitter-bot --dry-run --stream bitcoin --twitter-name 100trillionUSD + + [Install] + WantedBy=basic.target + +Example timer unit, running every 5 minutes: + + [Unit] + Description=Run zulip bot + + [Timer] + OnCalendar=*-*-* *:0/5 + + [Install] + WantedBy=timer.target diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..793ec82 --- /dev/null +++ b/default.nix @@ -0,0 +1,13 @@ +with import {}; + +python3.pkgs.buildPythonApplication { + pname = "zulip-twitter-bot"; + version = "latest"; + + src = ./.; + + propagatedBuildInputs = with python3.pkgs; [ + python-twitter zulip + ]; + +} diff --git a/dev.sh b/dev.sh deleted file mode 100755 index b7df4c1..0000000 --- a/dev.sh +++ /dev/null @@ -1 +0,0 @@ -nix-shell -p python310Packages.python-twitter python310Packages.zulip diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d5b90c3 --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup, find_packages + +setup( + name='Zulip Twitter Bot', + version='latest', + scripts=['twitter-bot'], + install_requires=['python-twitter', 'zulip'], +) -- cgit v1.2.3