]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/system/monitoring-1.nix
Add monitoring host
[perso/Immae/Config/Nix.git] / modules / private / system / monitoring-1.nix
1 { privateFiles }:
2 { config, pkgs, resources, ... }:
3 {
4 boot.kernelPackages = pkgs.linuxPackages_latest;
5 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
6 hostEnv.FQDN = "monitoring-1.v.immae.eu";
7
8 imports = builtins.attrValues (import ../..);
9
10 deployment = {
11 targetEnv = "hetznerCloud";
12 hetznerCloud = {
13 authToken = config.myEnv.hetznerCloud.authToken;
14 datacenter = "hel1-dc2";
15 location ="hel1";
16 serverType = "cx11";
17 };
18 };
19
20 myServices.monitoring.enable = true;
21 myServices.monitoring.master = true;
22 myServices.status.enable = true;
23 networking = {
24 firewall.enable = true;
25 interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
26 (n: ips: { address = ips.ip4; prefixLength = 32; })
27 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.myEnv.servers.monitoring-1.ips);
28 interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
29 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
30 config.myEnv.servers.monitoring-1.ips);
31 defaultGateway6 = { address = "fe80::1"; interface = "ens3"; };
32 };
33 myServices.mailRelay.enable = true;
34
35 # This value determines the NixOS release with which your system is
36 # to be compatible, in order to avoid breaking some software such as
37 # database servers. You should change this only after NixOS release
38 # notes say you should.
39 # https://nixos.org/nixos/manual/release-notes.html
40 system.stateVersion = "19.03"; # Did you read the comment?
41 }