tvl-depot/users/sterni/machines/ingeborg/network.nix
sterni 825b6ac65f feat(sterni/machines/ingeborg): boot-strap
Network configuration and initrd setup is basically the same as with
edwin, but we are using md for Software RAID this time as well as LVM
over two partitions with LUKS:

- sda2 <-- RAID1 --> sdb2 (boot-raid)
  └ boot partition, ext4 (encrypted-container-raid)
- sda3 <-- RAID1 --> sdb3
  └ LUKS container
    └ Volume Group vgmain
      ├ Logical Volume vgmain/swap
      │ └ swap
      └ Logical Volume vgmain/root
        └ btrfs

So we no longer rely on btrfs raid1 due to question marks over its
reliability (I personally did not have any problems though). This also
means that we have less LUKS containers we need to unlock when
booting (kind of neglible improvement). The biggest improvement is that
we have redundancy for the swap, so a disk failure shouldn't cause
memory corruption/loss.

Change-Id: I14f065b659857415917d9a60a7ec019e687f8d1c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10127
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
2023-11-25 22:55:32 +00:00

62 lines
1.2 KiB
Nix

{ config, pkgs, lib, depot, ... }:
let
ipv6 = "2a01:4f9:2a:1bc6::/64";
ipv4 = "95.216.27.158";
gatewayv4 = "95.216.27.129";
netmaskv4 = "255.255.255.192";
in
{
config = {
boot = {
kernelParams = [
"ip=${ipv4}::${gatewayv4}:${netmaskv4}::eth0:none"
];
initrd.network = {
enable = true;
ssh = {
enable = true;
authorizedKeys = depot.users.sterni.keys.all;
hostKeys = [
"/etc/nixos/unlock_rsa_key_openssh"
"/etc/nixos/unlock_ed25519_key_openssh"
];
};
postCommands = ''
echo 'cryptsetup-askpass' >> /root/.profile
'';
};
};
networking = {
usePredictableInterfaceNames = false;
useDHCP = false;
interfaces."eth0".useDHCP = false;
hostName = "ingeborg";
firewall = {
enable = true;
allowPing = true;
allowedTCPPorts = [ 22 ];
};
};
systemd.network = {
enable = true;
networks."eth0".extraConfig = ''
[Match]
Name = eth0
[Network]
Address = ${ipv6}
Gateway = fe80::1
Address = ${ipv4}/27
Gateway = ${gatewayv4}
'';
};
};
}