summary refs log tree commit diff stats
path: root/modules/silverbullet.nix
blob: ffdc59a066bcbb9d1f4038d2be2c1ce63bba282a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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"
  '';

}