summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/home/ham/signal-rest
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2021-05-15 13:13:13 +0200
committermakefu <github@syntax-fehler.de>2021-05-15 13:16:52 +0200
commit485807c22d20db9684612333cfda0b1fa63cf45a (patch)
treeba3870dcf3e1c4cfef7d6868683a459e6717dbe3 /makefu/2configs/home/ham/signal-rest
parent7f515fd150eb7672f272ee61f581ae7e0ff76e86 (diff)
ma home/ham: add signal-rest, update automations
Diffstat (limited to 'makefu/2configs/home/ham/signal-rest')
-rw-r--r--makefu/2configs/home/ham/signal-rest/default.nix20
-rw-r--r--makefu/2configs/home/ham/signal-rest/hass.nix20
-rw-r--r--makefu/2configs/home/ham/signal-rest/pkg.nix25
-rw-r--r--makefu/2configs/home/ham/signal-rest/service.nix18
4 files changed, 67 insertions, 16 deletions
diff --git a/makefu/2configs/home/ham/signal-rest/default.nix b/makefu/2configs/home/ham/signal-rest/default.nix
index 250a3596d..4eac41ba8 100644
--- a/makefu/2configs/home/ham/signal-rest/default.nix
+++ b/makefu/2configs/home/ham/signal-rest/default.nix
@@ -1,18 +1,6 @@
-
-let
- port = 8631;
- image = "bbernhard/signal-cli-rest-api:latest";
- config = "/var/lib/signal-cli-config";
-in {
- systemd.tmpfiles.rules = [
- "d ${config} docker docker - -"
+{
+ imports = [
+ ./service.nix
+ ./hass.nix
];
- state = [ config ];
- virtualisation.oci-containers.containers.signal-rest = {
- image = image;
- ports = [ "127.0.0.1:${toString port}:8080" ];
- volumes = [
- "${config}:/home/.local/share/signal-cli"
- ];
- };
}
diff --git a/makefu/2configs/home/ham/signal-rest/hass.nix b/makefu/2configs/home/ham/signal-rest/hass.nix
new file mode 100644
index 000000000..284be3320
--- /dev/null
+++ b/makefu/2configs/home/ham/signal-rest/hass.nix
@@ -0,0 +1,20 @@
+let
+ inherit (import <secrets/signal/messenger.nix>) number home felix;
+in {
+ services.home-assistant.config.notify = [
+ {
+ name = "signal_home";
+ platform = "signal_messenger";
+ url = "http://127.0.0.1:8631";
+ inherit number ;
+ recipients = [ home ];
+ }
+ {
+ name = "signal_felix";
+ platform = "signal_messenger";
+ url = "http://127.0.0.1:8631";
+ inherit number;
+ recipients = [ felix ];
+ }
+ ];
+}
diff --git a/makefu/2configs/home/ham/signal-rest/pkg.nix b/makefu/2configs/home/ham/signal-rest/pkg.nix
new file mode 100644
index 000000000..165d642af
--- /dev/null
+++ b/makefu/2configs/home/ham/signal-rest/pkg.nix
@@ -0,0 +1,25 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+ pname = "pysignalclirestapi";
+ version = "0.3.14";
+
+ # disabled = ; # requires python version >=2.7
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "6f3626b594a53c4161dfc67ea7a3b23d62c8fe8cb404a909496118aeefa79cd0";
+ };
+
+ doCheck = false;
+
+ meta = with lib; {
+ description = "Small python library for the Signal Cli REST API";
+ homepage = https://github.com/bbernhard/pysignalclirestapi;
+ #license = licenses.;
+ # maintainers = [ maintainers. ];
+ };
+}
diff --git a/makefu/2configs/home/ham/signal-rest/service.nix b/makefu/2configs/home/ham/signal-rest/service.nix
new file mode 100644
index 000000000..250a3596d
--- /dev/null
+++ b/makefu/2configs/home/ham/signal-rest/service.nix
@@ -0,0 +1,18 @@
+
+let
+ port = 8631;
+ image = "bbernhard/signal-cli-rest-api:latest";
+ config = "/var/lib/signal-cli-config";
+in {
+ systemd.tmpfiles.rules = [
+ "d ${config} docker docker - -"
+ ];
+ state = [ config ];
+ virtualisation.oci-containers.containers.signal-rest = {
+ image = image;
+ ports = [ "127.0.0.1:${toString port}:8080" ];
+ volumes = [
+ "${config}:/home/.local/share/signal-cli"
+ ];
+ };
+}