From 919e054d6fd5144a6a594322cfeffa8a35640494 Mon Sep 17 00:00:00 2001 From: clerie Date: Sat, 20 May 2023 17:13:45 +0200 Subject: [PATCH] host/mail-2: add host --- configuration/hetzner-cloud/default.nix | 8 +++++++ flake.nix | 1 + hosts/mail-2/configuration.nix | 21 ++++++++++++++++ hosts/mail-2/hardware-configuration.nix | 32 +++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 configuration/hetzner-cloud/default.nix create mode 100644 hosts/mail-2/configuration.nix create mode 100644 hosts/mail-2/hardware-configuration.nix diff --git a/configuration/hetzner-cloud/default.nix b/configuration/hetzner-cloud/default.nix new file mode 100644 index 0000000..c962933 --- /dev/null +++ b/configuration/hetzner-cloud/default.nix @@ -0,0 +1,8 @@ +{ ... }: + +{ + networking.useDHCP = false; + networking.defaultGateway6 = { address = "fe80::1"; interface = "ens3"; }; + networking.defaultGateway = { address = "172.31.1.1"; interface = "ens3"; }; + networking.nameservers = [ "2a01:4ff:ff00::add:2" "2a01:4ff:ff00::add:1" "185.12.64.2" "185.12.64.1" ]; +} diff --git a/flake.nix b/flake.nix index b682b7b..6cc79f8 100644 --- a/flake.nix +++ b/flake.nix @@ -41,6 +41,7 @@ gatekeeper = { name = "gatekeeper"; }; hydra-1 = { name = "hydra-1"; }; hydra-2 = { name = "hydra-2"; }; + mail-2 = { name = "mail-2"; }; minecraft-2 = { name = "minecraft-2"; }; monitoring-3 = { name = "monitoring-3"; }; nonat = { name = "nonat"; }; diff --git a/hosts/mail-2/configuration.nix b/hosts/mail-2/configuration.nix new file mode 100644 index 0000000..9710cd0 --- /dev/null +++ b/hosts/mail-2/configuration.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + imports = + [ + ./hardware-configuration.nix + ../../configuration/hetzner-cloud + ]; + + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + + networking.hostName = "mail-2"; + + networking.interfaces.ens3.ipv6.addresses = [ { address = "2a01:4f8:1c1c:9577::1"; prefixLength = 64; } ]; + networking.interfaces.ens3.ipv4.addresses = [ { address = "5.75.187.112"; prefixLength = 32; } ]; + + system.stateVersion = "22.11"; +} + diff --git a/hosts/mail-2/hardware-configuration.nix b/hosts/mail-2/hardware-configuration.nix new file mode 100644 index 0000000..3957ab2 --- /dev/null +++ b/hosts/mail-2/hardware-configuration.nix @@ -0,0 +1,32 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "virtio_pci" "virtio_scsi" "xhci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/df649bac-4232-44bb-a5f5-87cddaeb1f99"; + fsType = "ext4"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}