2 { config, pkgs, resources, name, ... }:
6 targetHost = config.hostEnv.ips.main.ip4;
7 substituteOnDestination = true;
9 boot.kernelPackages = pkgs.linuxPackages_latest;
10 myEnv = import "${privateFiles}/environment.nix" // { inherit privateFiles; };
12 imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ] ++ builtins.attrValues (import ../..);
17 device = "UUID=b9425333-f567-435d-94d8-b26c22d93426";
19 "/" = { device = "/dev/sda1"; fsType = "ext4"; };
23 firewall.enable = true;
24 interfaces."ens3".ipv4.addresses = pkgs.lib.attrsets.mapAttrsToList
25 (n: ips: { address = ips.ip4; prefixLength = 32; })
26 (pkgs.lib.attrsets.filterAttrs (n: v: n != "main") config.hostEnv.ips);
27 interfaces."ens3".ipv6.addresses = pkgs.lib.flatten (pkgs.lib.attrsets.mapAttrsToList
28 (n: ips: map (ip: { address = ip; prefixLength = (if n == "main" && ip == pkgs.lib.head ips.ip6 then 64 else 128); }) (ips.ip6 or []))
30 defaultGateway6 = { address = "fe80::1"; interface = "ens3"; };
33 boot.loader.grub.device = "nodev";
35 myServices.certificates.enable = true;
36 security.acme.certs."${name}" = {
37 user = config.services.nginx.user;
38 group = config.services.nginx.group;
42 recommendedOptimisation = true;
43 recommendedGzipSettings = true;
44 recommendedProxySettings = true;
46 networking.firewall.allowedTCPPorts = [ 80 443 ];
49 mailto = "cron@immae.eu";
53 services.rsyncBackup = {
54 mountpoint = "/backup2";
55 profiles = config.myEnv.rsync_backup.profiles;
56 ssh_key_public = config.myEnv.rsync_backup.ssh_key.public;
57 ssh_key_private = config.myEnv.rsync_backup.ssh_key.private;
60 myServices.mailRelay.enable = true;
61 myServices.mailBackup.enable = true;
62 myServices.monitoring.enable = true;
63 myServices.databasesReplication = {
67 mainPackage = pkgs.postgresql;
71 connection = "postgresql://backup-2:${config.hostEnv.ldap.password}@eldiron.immae.eu";
72 package = pkgs.postgresql;
82 # mysql resolves "backup-2" host and checks the ip, but uses /etc/hosts which only contains ip4
83 host = config.myEnv.servers.eldiron.ips.main.ip4;
86 password = config.hostEnv.ldap.password;
88 dumpPassword = config.myEnv.databases.mysql.systemUsers.root;
107 url = "ldaps://${config.myEnv.ldap.host}:636";
108 dn = config.myEnv.ldap.replication_dn;
109 password = config.myEnv.ldap.replication_pw;
110 base = config.myEnv.ldap.base;
116 # This value determines the NixOS release with which your system is
117 # to be compatible, in order to avoid breaking some software such as
118 # database servers. You should change this only after NixOS release
119 # notes say you should.
120 # https://nixos.org/nixos/manual/release-notes.html
121 system.stateVersion = "20.03"; # Did you read the comment?