{ config, lib, pkgs, ... }:

{
  networking.bridges.lxcbr0.interfaces = [];
  networking.interfaces.lxcbr0.ipv4.addresses = [
    {
      address = "10.1.2.1";
      prefixLength = 24;
    }
  ];
  networking.nat.internalInterfaces = [ "lxcbr0" ];

  virtualisation.lxc.enable = true;
  virtualisation.lxc.systemConfig = ''
    lxc.bdev.zfs.root = zroot/safe/containers/lxc
    lxc.lxcpath = /persist/lxc
  '';

  users.users.root.subUidRanges = [{ count = 65536; startUid = 100000; }];
  users.users.root.subGidRanges = [{ count = 65536; startGid = 100000; }];

  environment.etc."lxc/share".source = "${pkgs.lxc}/share/lxc";


  services.nginx.virtualHosts."onlyoffice.infra4future.de" = {
    locations."/".proxyPass = "http://10.1.2.233:80";
    enableACME = true;
    forceSSL = true;
  };

  services.nginx.virtualHosts."auth.infra4future.de" = {
    locations."/".proxyPass = "http://10.1.2.104:8080";
    enableACME = true;
    forceSSL = true;
  };
}
