1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8with lib;
9
10let
11 cfg = config.services.scion;
12in
13{
14 options.services.scion = {
15 enable = mkEnableOption "all of the scion components and services";
16 package = mkPackageOption pkgs "scion" { };
17 stateless = mkOption {
18 type = types.bool;
19 default = true;
20 description = ''
21 Setting this value to false (stateful) can lead to improved caching and
22 performance.
23
24 This option decides whether to persist the SCION path sqlite databases
25 on disk or not. Persisting this data can lead to database corruption in
26 extreme cases such as power outage, meaning SCION fails to work on the
27 next boot. This is being investigated.
28
29 If true, /run/scion-* is used for data
30 If false, use /var/lib/scion-* is used for data
31 '';
32 };
33 bypassBootstrapWarning = mkOption {
34 type = types.bool;
35 default = false;
36 description = ''
37 bypass Nix warning about SCION PKI bootstrapping
38 '';
39 };
40 };
41 config = mkIf cfg.enable {
42 environment.systemPackages = [
43 cfg.package
44 ];
45 services.scion = {
46 scion-dispatcher.enable = true;
47 scion-daemon.enable = true;
48 scion-router.enable = true;
49 scion-control.enable = true;
50 scion-ip-gateway.enable = true;
51 };
52 assertions = [
53 {
54 assertion = cfg.bypassBootstrapWarning == true;
55 message = ''
56 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:
57
58 services.scion.bypassBootstrapWarning = true;
59
60 refer to docs.scion.org for more information
61 '';
62 }
63 ];
64 };
65}