92 lines
2.2 KiB
Nix
92 lines
2.2 KiB
Nix
|
{ pkgs, lib, config, ... }:
|
||
|
let
|
||
|
cfg = config.bagel.baremetal;
|
||
|
in
|
||
|
{
|
||
|
options = {
|
||
|
bagel.baremetal = {
|
||
|
enable = lib.mkEnableOption "baremetal bagel oven";
|
||
|
netboot = lib.mkEnableOption "netboot";
|
||
|
num = lib.mkOption {
|
||
|
type = lib.types.int;
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = lib.mkIf cfg.enable {
|
||
|
boot.initrd.availableKernelModules = [ "ahci" "ehci_pci" "usb_storage" "usbhid" "sd_mod" ];
|
||
|
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||
|
|
||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||
|
hardware.cpu.intel.updateMicrocode = true;
|
||
|
|
||
|
boot.loader.systemd-boot.enable = true;
|
||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||
|
boot.initrd.systemd.enable = true;
|
||
|
boot.initrd.services.lvm.enable = true;
|
||
|
|
||
|
boot.kernel.sysctl."fs.xfs.xfssyncd_centisecs" = "12000";
|
||
|
fileSystems = lib.mkIf (!cfg.netboot) {
|
||
|
"/" = {
|
||
|
device = "/dev/disk/by-label/root";
|
||
|
fsType = "xfs";
|
||
|
};
|
||
|
|
||
|
"/boot" = {
|
||
|
device = "/dev/disk/by-label/BOOT";
|
||
|
fsType = "vfat";
|
||
|
options = [ "fmask=0022" "dmask=0022" ];
|
||
|
};
|
||
|
};
|
||
|
|
||
|
zramSwap = {
|
||
|
enable = true;
|
||
|
memoryPercent = 25;
|
||
|
};
|
||
|
|
||
|
boot.kernelParams = [
|
||
|
"console=tty1"
|
||
|
"console=ttyS0,115200"
|
||
|
];
|
||
|
|
||
|
networking.useNetworkd = true;
|
||
|
networking.domain = "wob01.infra.forkos.org";
|
||
|
|
||
|
systemd.network = {
|
||
|
netdevs = {
|
||
|
"40-uplink" = {
|
||
|
netdevConfig = {
|
||
|
Kind = "bond";
|
||
|
Name = "uplink";
|
||
|
};
|
||
|
bondConfig = {
|
||
|
Mode = "802.3ad";
|
||
|
TransmitHashPolicy = "layer3+4";
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
networks = {
|
||
|
"40-eno1" = {
|
||
|
name = "eno1";
|
||
|
bond = [ "uplink" ];
|
||
|
};
|
||
|
"40-eno2" = {
|
||
|
name = "eno2";
|
||
|
bond = [ "uplink" ];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
networking.interfaces.uplink.ipv6.addresses = [
|
||
|
{ address = "2a01:584:11::1:${toString cfg.num}"; prefixLength = 64; }
|
||
|
];
|
||
|
networking.defaultGateway6 = { interface = "uplink"; address = "2a01:584:11::1"; };
|
||
|
deployment.targetHost = "2a01:584:11::1:${toString cfg.num}";
|
||
|
|
||
|
bagel.sysadmin.enable = true;
|
||
|
|
||
|
environment.systemPackages = [ pkgs.ipmitool ];
|
||
|
|
||
|
system.stateVersion = "24.05";
|
||
|
};
|
||
|
}
|