aboutsummaryrefslogtreecommitdiff
path: root/modules/private/gemini/default.nix
blob: ffe8a121bfa2ff348f45df3b0924dcd1c0bee03a (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
{ lib, config, pkgs, ... }:
let
  configFile = pkgs.writeText "config.yaml" ''
    listen: ":1965"
    hosts:
      immae.eu:
        cert: /var/lib/acme/immae/full.pem
        key: /var/lib/acme/immae/key.pem
        paths:
          - path: /
            root: ${./public}
  '';
in
{
  options.myServices.gemini.enable = lib.mkEnableOption "enable Gemini capsule";
  config = lib.mkIf config.myServices.gemini.enable {
    networking.firewall.allowedTCPPorts = [ 1965 ];
    systemd.services.gemini = {
      description = "Gemini capsule server";
      wantedBy = [ "multi-user.target" ];
      after = [ "network.target" ];
      serviceConfig.ExecStart = "${pkgs.twins}/bin/twins -config ${configFile}";
      serviceConfig.Type = "simple";
    };
  };
}