aboutsummaryrefslogtreecommitdiff
path: root/systems/eldiron/gemini/default.nix
blob: 600afbc9cab5342f0bd80a97dedba72c471ada2a (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ 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 {
    security.acme.certs.immae.postRun = ''
      systemctl restart gemini.service
    '';
    myServices.chatonsProperties.hostings.gemini = {
      file.datetime = "2022-08-27T18:00:00";
      hosting = {
        name = "Hébergement Gemini";
        description = "Hébergement de capsules Gemini";
        type = "INSTANCE";
        website = "gemini://immae.eu";
        status.level = "OK";
        status.description = "OK";
        registration.load = "OPEN";
        install.type = "PACKAGE";
      };
      software = {
        name = "twins";
        website = "https://code.rocketnine.space/tslocum/twins";
        license.url = "https://code.rocketnine.space/tslocum/twins/src/branch/master/LICENSE";
        license.name = "MIT License";
        version = pkgs.twins.version;
        source.url = "https://code.rocketnine.space/tslocum/twins";
      };
    };
    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";
    };
  };
}