]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/system/monitoring-1.nix
Migrate to morph as a replacement to nixops
[perso/Immae/Config/Nix.git] / modules / private / system / monitoring-1.nix
1 { privateFiles }:
2 { config, pkgs, resources, ... }:
3 {
4 deployment = {
5 targetUser = "root";
6 targetHost = config.hostEnv.ips.main.ip4;
7 substituteOnDestination = true;
8 };
9 boot.kernelPackages = pkgs.linuxPackages_latest;
10 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
11
12 imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ] ++ builtins.attrValues (import ../..);
13
14 myServices.monitoring.enable = true;
15 myServices.monitoring.master = true;
16 myServices.status.enable = true;
17 networking = {
18 firewall.enable = true;
19 interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
20 (n: ips: { address = ips.ip4; prefixLength = 32; })
21 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
22 interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
23 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
24 config.hostEnv.ips);
25 defaultGateway6 = { address = "fe80::1"; interface = "ens3"; };
26 };
27 boot.loader.grub.device = "nodev";
28 fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; };
29 myServices.mailRelay.enable = true;
30
31 security.pki.certificateFiles = [
32 (pkgs.fetchurl {
33 url = "http://downloads.e.eriomem.net/eriomemca.pem";
34 sha256 = "1ixx4c6j3m26j8dp9a3dkvxc80v1nr5aqgmawwgs06bskasqkvvh";
35 })
36 ];
37
38 # This value determines the NixOS release with which your system is
39 # to be compatible, in order to avoid breaking some software such as
40 # database servers. You should change this only after NixOS release
41 # notes say you should.
42 # https://nixos.org/nixos/manual/release-notes.html
43 system.stateVersion = "20.03"; # Did you read the comment?
44 }