infra/nix/os/devices/srv0-dmz0/configuration.nix

136 lines
3.3 KiB
Nix
Raw Normal View History

2023-07-06 22:42:24 +02:00
{
modulesPath,
repoFlake,
config,
...
2024-11-15 10:17:56 +01:00
}:
let
disk = "/dev/disk/by-id/ata-INTEL_SSDSC2BW240A4_PHDA435602332403GN";
2024-11-15 10:17:56 +01:00
in
{
disabledModules = [ ];
2023-07-06 22:42:24 +02:00
imports = [
repoFlake.inputs.disko.nixosModules.disko
repoFlake.inputs.srvos.nixosModules.server
(modulesPath + "/profiles/all-hardware.nix")
repoFlake.inputs.srvos.nixosModules.mixins-terminfo
repoFlake.inputs.srvos.nixosModules.mixins-systemd-boot
repoFlake.inputs.sops-nix.nixosModules.sops
../../profiles/common/user.nix
];
## bare-metal machines
2024-11-15 10:17:56 +01:00
srvos.boot.consoles = [ "tty0" ];
2023-07-06 22:42:24 +02:00
boot.loader.grub.enable = false;
boot.loader.efi.canTouchEfiVariables = false;
disko.devices.disk.main = {
device = disk;
type = "disk";
content = {
type = "table";
format = "gpt";
partitions = [
{
name = "boot";
start = "0";
end = "1M";
part-type = "primary";
2024-11-15 10:17:56 +01:00
flags = [ "bios_grub" ];
2023-07-06 22:42:24 +02:00
}
{
name = "ESP";
start = "1M";
end = "512M";
bootable = true;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "root";
start = "512M";
end = "100%";
part-type = "primary";
bootable = true;
content = {
type = "btrfs";
2024-11-15 10:17:56 +01:00
extraArgs = [ "-f" ]; # Override existing partition
2023-07-06 22:42:24 +02:00
subvolumes = {
# Subvolume name is different from mountpoint
"/rootfs" = {
mountpoint = "/";
};
"/nix" = {
2024-11-15 10:17:56 +01:00
mountOptions = [ "noatime" ];
2023-07-06 22:42:24 +02:00
};
};
};
}
];
};
};
hardware.enableAllFirmware = true;
nixpkgs.config.allowUnfree = true;
hardware.enableRedistributableFirmware = true;
hardware.cpu.intel.updateMicrocode = true;
services.openssh.enable = true;
systemd.network.enable = true;
systemd.network.networks."10-lan" = {
matchConfig.Name = "eth*";
networkConfig = {
# enable DHCP for IPv4 *and* IPv6
DHCP = "yes";
# accept Router Advertisements for Stateless IPv6 Autoconfiguraton (SLAAC)
IPv6AcceptRA = true;
};
};
networking.dhcpcd.enable = false;
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [
22
# iperf3
5201
];
networking.firewall.logRefusedConnections = false;
networking.usePredictableInterfaceNames = false;
networking.nat = {
enable = true;
2024-11-15 10:17:56 +01:00
internalInterfaces = [ "ve-+" ];
2023-07-06 22:42:24 +02:00
externalInterface = "eth0";
};
# Kubernetes
# services.kubernetes.roles = ["master" "node"];
# virtualization
# virtualisation = {docker.enable = true;};
2024-11-15 10:17:56 +01:00
nix.gc = {
automatic = true;
};
2023-07-06 22:42:24 +02:00
2024-11-15 10:17:56 +01:00
containers = { };
2023-07-06 22:42:24 +02:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
2023-07-06 22:42:24 +02:00
}