summary refs log tree commit diff stats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/silverbullet.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/silverbullet.nix b/modules/silverbullet.nix
new file mode 100644
index 0000000..ffdc59a
--- /dev/null
+++ b/modules/silverbullet.nix
@@ -0,0 +1,27 @@
+{ pkgs, libs, config, ... }:
+{
+
+  services.silverbullet = {
+    enable = true;
+    listenPort = 3000;
+    listenAddress = "localhost";
+    envFile = "/secret/silverbullet.env";
+  };
+  
+  services.nginx.virtualHosts."notes.krinitsin.com" = {
+    forceSSL = true;
+    useACMEHost = "krinitsin.com";
+    locations."/".proxyPass = "http://localhost:3000";
+  };
+
+  security.acme.certs."krinitsin.com".extraDomainNames = [ "notes.krinitsin.com" ];
+
+  networking.firewall.allowedTCPPorts = [ 3000 ];
+
+  services.monit.config = ''
+    check process silverbullet with matching "silverbullet"
+    start program = "${pkgs.systemd}/bin/systemctl start silverbullet"
+    stop program = "${pkgs.systemd}/bin/systemctl stop silverbullet"
+  '';
+
+}