about summary refs log tree commit diff
path: root/nixos/modules/services/networking/scion/scion.nix
blob: 0ae959484d326853cb94d4b0972b9a43f2c5e946 (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
51
52
53
54
55
56
57
58
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.scion;
in
{
  options.services.scion = {
    enable = mkEnableOption "all of the scion components and services";
    stateless = mkOption {
      type = types.bool;
      default = true;
      description = ''
        Setting this value to false (stateful) can lead to improved caching and
        performance.

        This option decides whether to persist the SCION path sqlite databases
        on disk or not. Persisting this data can lead to database corruption in
        extreme cases such as power outage, meaning SCION fails to work on the
        next boot. This is being investigated.

        If true, /run/scion-* is used for data
        If false, use /var/lib/scion-* is used for data
      '';
    };
    bypassBootstrapWarning = mkOption {
      type = types.bool;
      default = false;
      description = ''
        bypass Nix warning about SCION PKI bootstrapping
      '';
    };
  };
  config = mkIf cfg.enable {
    environment.systemPackages = [
      pkgs.scion
    ];
    services.scion = {
      scion-dispatcher.enable = true;
      scion-daemon.enable = true;
      scion-router.enable = true;
      scion-control.enable = true;
    };
    assertions = [
      { assertion = cfg.bypassBootstrapWarning == true;
        message = ''
          SCION is a routing protocol and requires bootstrapping with a manual, imperative key signing ceremony. You may want to join an existing Isolation Domain (ISD) such as scionlab.org, or bootstrap your own. If you have completed and configured the public key infrastructure for SCION and are sure this process is complete, then add the following to your configuration:

          services.scion.bypassBootstrapWarning = true;

          refer to docs.scion.org for more information
        '';
      }
    ];
  };
}