summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2022-07-05 11:39:55 -0400
committerBen Sima <ben@bsima.me>2022-07-05 11:39:55 -0400
commit02a806624b8a66114192ac75ae4114a3c088b170 (patch)
tree7421c43b57000b6bf316f4a57c8885a601fd3335
parent8b324c4becd6e42352de30d74dc931f50263bb4c (diff)
Add setup and build infoHEADmaster
-rw-r--r--.gitignore2
-rw-r--r--README40
-rw-r--r--default.nix13
-rwxr-xr-xdev.sh1
-rw-r--r--setup.py8
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*
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 <nixpkgs> {};
+
+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'],
+)