- netboot-base.nix with SSH key auth - Launch scripts for node01/02/03 - Node configuration.nix and disko.nix - Nix modules for first-boot automation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
99 lines
2 KiB
Nix
99 lines
2 KiB
Nix
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
|
imports = [
|
|
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
|
|
];
|
|
|
|
# Boot configuration
|
|
boot.loader.grub.enable = true;
|
|
boot.loader.grub.device = "/dev/vda";
|
|
|
|
# Filesystems
|
|
fileSystems."/" = {
|
|
device = "/dev/vda1";
|
|
fsType = "ext4";
|
|
};
|
|
|
|
# Network configuration
|
|
networking.hostName = "pxe-server";
|
|
networking.domain = "plasma.local";
|
|
networking.useDHCP = false;
|
|
|
|
# eth0: multicast network (static IP)
|
|
networking.interfaces.eth0 = {
|
|
useDHCP = false;
|
|
ipv4.addresses = [{
|
|
address = "192.168.100.1";
|
|
prefixLength = 24;
|
|
}];
|
|
};
|
|
|
|
# eth1: user network (DHCP for internet)
|
|
networking.interfaces.eth1.useDHCP = true;
|
|
|
|
# DNS
|
|
networking.nameservers = [ "8.8.8.8" "8.8.4.4" ];
|
|
|
|
# Firewall
|
|
networking.firewall.enable = false;
|
|
|
|
# dnsmasq for DHCP/DNS/TFTP
|
|
services.dnsmasq = {
|
|
enable = true;
|
|
settings = {
|
|
# Listen only on eth0 (multicast network)
|
|
interface = "eth0";
|
|
|
|
# DHCP configuration
|
|
dhcp-range = "192.168.100.100,192.168.100.150,12h";
|
|
dhcp-option = [
|
|
"3,192.168.100.1" # Gateway
|
|
"6,192.168.100.1" # DNS server
|
|
];
|
|
|
|
# Static DHCP leases
|
|
dhcp-host = [
|
|
"52:54:00:00:01:01,node01,192.168.100.11"
|
|
"52:54:00:00:01:02,node02,192.168.100.12"
|
|
"52:54:00:00:01:03,node03,192.168.100.13"
|
|
];
|
|
|
|
# DNS configuration
|
|
domain = "plasma.local";
|
|
local = "/plasma.local/";
|
|
|
|
# TFTP configuration
|
|
enable-tftp = true;
|
|
tftp-root = "/var/lib/tftpboot";
|
|
|
|
# Logging
|
|
log-queries = true;
|
|
log-dhcp = true;
|
|
};
|
|
};
|
|
|
|
# Create TFTP boot directory
|
|
systemd.tmpfiles.rules = [
|
|
"d /var/lib/tftpboot 0755 root root -"
|
|
];
|
|
|
|
# SSH for remote access
|
|
services.openssh = {
|
|
enable = true;
|
|
settings.PermitRootLogin = "yes";
|
|
};
|
|
|
|
# Root password (for SSH access)
|
|
users.users.root.password = "plasmacloud";
|
|
|
|
# Packages
|
|
environment.systemPackages = with pkgs; [
|
|
vim
|
|
curl
|
|
htop
|
|
];
|
|
|
|
# System state version
|
|
system.stateVersion = "24.05";
|
|
}
|