1 { config, pkgs, resources, name, ... }:
5 targetHost = config.hostEnv.ips.main.ip4;
6 substituteOnDestination = true;
8 # ssh-keyscan backup-2 | nix-shell -p ssh-to-age --run ssh-to-age
9 secrets.ageKeys = [ "age1kk3nr27qu42j28mcfdag5lhq0zu2pky7gfanvne8l4z2ctevjpgskmw0sr" ];
10 boot.kernelPackages = pkgs.linuxPackages_latest;
11 myEnv = import ../../../nixops/secrets/environment.nix;
13 imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ] ++ builtins.attrValues (import ../..);
18 device = "UUID=b9425333-f567-435d-94d8-b26c22d93426";
20 "/" = { device = "/dev/sda1"; fsType = "ext4"; };
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.hostEnv.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 []))
31 defaultGateway6 = { address = "fe80::1"; interface = "ens3"; };
34 boot.loader.grub.device = "nodev";
36 myServices.certificates.enable = true;
37 security.acme.certs."${name}" = {
38 user = config.services.nginx.user;
39 group = config.services.nginx.group;
43 recommendedOptimisation = true;
44 recommendedGzipSettings = true;
45 recommendedProxySettings = true;
47 networking.firewall.allowedTCPPorts = [ 80 443 ];
50 mailto = "cron@immae.eu";
54 services.rsyncBackup = {
55 mountpoint = "/backup2";
56 profiles = config.myEnv.rsync_backup.profiles;
57 ssh_key_public = config.myEnv.rsync_backup.ssh_key.public;
58 ssh_key_private = config.myEnv.rsync_backup.ssh_key.private;
61 myServices.mailRelay.enable = true;
62 myServices.mailBackup.enable = true;
63 myServices.monitoring.enable = true;
64 myServices.databasesReplication = {
68 mainPackage = pkgs.postgresql;
72 connection = "postgresql://backup-2:${config.hostEnv.ldap.password}@eldiron.immae.eu";
73 package = pkgs.postgresql;
83 # mysql resolves "backup-2" host and checks the ip, but uses /etc/hosts which only contains ip4
84 host = config.myEnv.servers.eldiron.ips.main.ip4;
87 password = config.hostEnv.ldap.password;
89 dumpPassword = config.myEnv.databases.mysql.systemUsers.root;
108 url = "ldaps://${config.myEnv.ldap.host}:636";
109 dn = config.myEnv.ldap.replication_dn;
110 password = config.myEnv.ldap.replication_pw;
111 base = config.myEnv.ldap.base;
117 # This value determines the NixOS release with which your system is
118 # to be compatible, in order to avoid breaking some software such as
119 # database servers. You should change this only after NixOS release
120 # notes say you should.
121 # https://nixos.org/nixos/manual/release-notes.html
122 system.stateVersion = "20.03"; # Did you read the comment?