blob: abc0eb142b16cbb85a5546b13708c2b7ccb46d9e (
plain)
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.yggdrasilTinc;
in {
options = {
services.yggdrasilTinc = {
enable = mkEnableOption "yggdrasil tinc network";
connect = mkOption {
default = true;
type = types.bool;
description = ''
Connect to central server
'';
};
useDNS = mkOption {
default = true;
type = types.bool;
description = ''
Use heimdallr as primary dns server
'';
};
name = mkOption {
default = config.networking.hostName;
type = types.str;
description = ''
Node identifier
'';
};
interfaceConfig = mkOption {
default = {};
description = ''
Additional configuration for the generated network interface
'';
};
};
};
config = mkIf cfg.enable {
services.customTinc.networks."yggdrasil" = {
inherit (cfg) name interfaceConfig;
debugLevel = 2;
hosts = import ../../yggdrasil/hosts.nix;
interfaceType = "tap";
extraConfig = ''
Mode = switch
PingTimeout = 30
${optionalString cfg.connect "ConnectTo = ymir"}
'';
};
};
}
|