diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README | 40 | ||||
-rw-r--r-- | default.nix | 13 | ||||
-rwxr-xr-x | dev.sh | 1 | ||||
-rw-r--r-- | setup.py | 8 |
5 files changed, 63 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e917d0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +*.egg-info* @@ -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 <nixpkgs> {}; + +python3.pkgs.buildPythonApplication { + pname = "zulip-twitter-bot"; + version = "latest"; + + src = ./.; + + propagatedBuildInputs = with python3.pkgs; [ + python-twitter zulip + ]; + +} @@ -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'], +) |