about summary refs log tree commit diff
path: root/machines/profpatsch/katara.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2018-03-28 07:33:39 +0200
committerProfpatsch <mail@profpatsch.de>2018-05-01 21:28:02 +0200
commit2a22d5c54f923ece8247dd4095afeea3ed7cf7d4 (patch)
tree210c256917afd62664975843f9d3f5a279ce089f /machines/profpatsch/katara.nix
parent815211add6078eb2f223e07a4efbd89880ddcb9e (diff)
machines/katara: add user services for pyrnotify
Diffstat (limited to 'machines/profpatsch/katara.nix')
-rw-r--r--machines/profpatsch/katara.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/machines/profpatsch/katara.nix b/machines/profpatsch/katara.nix
index 2e480da9..68e91981 100644
--- a/machines/profpatsch/katara.nix
+++ b/machines/profpatsch/katara.nix
@@ -400,6 +400,36 @@ in {
         };
       }
 
+      ({
+        services.pyrnotify-ssh-connection = {
+          description = "ssh connection to make pyrnotify work";
+          serviceConfig = {
+            Environment = ''"SSH_AUTH_SOCK=%t/gnupg/S.gpg-agent.ssh"'';
+            # forwards the remote socket over ssh, restarts every 5 minutes
+            ExecStart = pkgs.writeScript "pyrnotify-start-ssh" ''
+              #!${pkgs.stdenv.shell}
+              ${lib.getBin pkgs.openssh}/bin/ssh \
+                bigmac \
+                "rm /home/bigmac/.weechat/pyrnotify.socket"
+              ${lib.getBin pkgs.openssh}/bin/ssh \
+                -R /home/bigmac/.weechat/pyrnotify.socket:localhost:8099 \
+                bigmac \
+                "sleep 300"
+            '';
+            Restart = "on-failure";
+          };
+        };
+        services.pyrnotify-listen = rec {
+          description = "get notified about weechat messages";
+          serviceConfig = {
+            ExecStart = "${lib.getBin pkgs.python
+              }/bin/python ${myPkgs.pyrnotify} 8099";
+          };
+          requires = [ "pyrnotify-ssh-connection.service" ];
+          after = requires;
+        };
+      })
+
     ];
 
   };