summaryrefslogtreecommitdiffstats
path: root/makefu/1systems/wry.nix
blob: 63b1f47f711971e71e788300df2ddeaeb0d48211 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{ config, lib, pkgs, ... }:

with lib;
let

  external-ip = head config.krebs.build.host.nets.internet.addrs4;
  internal-ip = head config.krebs.build.host.nets.retiolum.addrs4;
in {
  imports = [
      # TODO: copy this config or move to krebs
      ../../tv/2configs/CAC-CentOS-7-64bit.nix
      ../2configs/base.nix
      ../2configs/unstable-sources.nix
      ../2configs/tinc-basic-retiolum.nix

      ../2configs/bepasty-dual.nix

      ../2configs/iodined.nix

      # Reaktor
      ../2configs/Reaktor/simpleExtend.nix
  ];

  krebs.build = {
    user = config.krebs.users.makefu;
    target = "root@wry";
    host = config.krebs.hosts.wry;
  };



  krebs.Reaktor.enable = true;

  # bepasty to listen only on the correct interfaces
  krebs.bepasty.servers.internal.nginx.listen  = [ "${internal-ip}:80" ];
  krebs.bepasty.servers.external.nginx.listen  = [ "${external-ip}:80" "${external-ip}:443 ssl" ];

  # prepare graphs
  krebs.nginx.enable = true;
  krebs.retiolum-bootstrap.enable = true;

  nixpkgs.config.packageOverrides = pkgs: { tinc = pkgs.tinc_pre; };
  makefu.tinc_graphs = {
    enable = true;
    nginx = {
      enable = true;
      # TODO: remove hard-coded hostname
      complete = {
        listen = [ "${internal-ip}:80" ];
        server-names = [ "graphs.wry" ];
      };
      anonymous = {
        listen = [ "${external-ip}:80" ] ;
        server-names = [ "graphs.krebsco.de" ];
      };
    };
  };
  networking = {
    firewall.allowPing = true;
    firewall.allowedTCPPorts = [ 53 80 443 ];
    interfaces.enp2s1.ip4 = [{
      address = external-ip;
      prefixLength = 24;
    }];
    defaultGateway = "104.233.87.1";
    nameservers = [ "8.8.8.8" ];
  };


  # based on ../../tv/2configs/CAC-Developer-2.nix
  sound.enable = false;
}