This repository has no description
1.7 kB
65 lines
1{ config, pkgs, ... }:
2
3{
4
5 networking.firewall.allowedTCPPorts = [ 655 ];
6 networking.firewall.allowedUDPPorts = [ 655 ];
7
8 krebs.tinc.retiolum = {
9 enable = true;
10 connectTo = [
11 "neoprism"
12 "prism"
13 "ni"
14 "eve"
15 ];
16 extraConfig = ''
17 AutoConnect = yes
18 LocalDiscovery = yes
19 '';
20 privkey = config.clan.core.vars.generators.retiolum.files."retiolum.rsa_key.priv".path;
21 privkey_ed25519 = config.clan.core.vars.generators.retiolum.files."retiolum.ed25519_key.priv".path;
22 };
23
24 clan.core.vars.generators.retiolum = {
25 files."retiolum.rsa_key.priv" = { };
26 files."retiolum.ed25519_key.priv" = { };
27 files."retiolum.rsa_key.pub".secret = false;
28 files."retiolum.ed25519_key.pub".secret = false;
29 migrateFact = "retiolum";
30 runtimeInputs = with pkgs; [
31 coreutils
32 tinc_pre
33 ];
34 script = ''
35 tinc --config "$out" generate-keys 4096 >/dev/null
36 mv "$out"/rsa_key.priv "$out"/retiolum.rsa_key.priv
37 mv "$out"/ed25519_key.priv "$out"/retiolum.ed25519_key.priv
38 mv "$out"/rsa_key.pub "$out"/retiolum.rsa_key.pub
39 mv "$out"/ed25519_key.pub "$out"/retiolum.ed25519_key.pub
40 '';
41 };
42
43 systemd.network.networks.retiolum = {
44 matchConfig.Name = "retiolum";
45 address = [
46 "${config.krebs.build.host.nets.retiolum.ip4.addr}/16"
47 "${config.krebs.build.host.nets.retiolum.ip6.addr}/16"
48 ];
49 linkConfig = {
50 MTUBytes = "1377";
51 RequiredForOnline = "no";
52 };
53 networkConfig = {
54 LinkLocalAddressing = "no";
55 };
56 };
57
58 nixpkgs.config.packageOverrides = pkgs: {
59 tinc = pkgs.tinc_pre;
60 };
61
62 environment.systemPackages = [
63 pkgs.tinc
64 ];
65}