nixos-config/machines/okarin/hardware-configuration.nix

67 lines
1.7 KiB
Nix
Raw Permalink Normal View History

# SPDX-FileCopyrightText: 2023-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
2023-05-06 10:54:03 +02:00
{ lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
sbruder.machine.isVm = true;
2023-05-06 10:54:03 +02:00
boot = {
kernelModules = [ ];
extraModulePackages = [ ];
kernelParams = [ "ip=dhcp" ];
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "sd_mod" "sr_mod" "virtio_net" "virtio_pci" "xhci_pci" ];
kernelModules = [ ];
2023-05-06 10:54:03 +02:00
network = {
enable = true; # remote unlocking
# for some reason, the DHCP server does not transmit the static route to the gateway in a form udhcpc understands
# this works around this, but is arguably quite hacky
postCommands = ''
ip route add 85.215.165.1 dev eth0
ip route add default via 85.215.165.1 dev eth0
2023-05-06 10:54:03 +02:00
'';
};
luks.devices."root".device = "/dev/disk/by-uuid/1dcb9ee1-5594-4174-98a7-a362da09f131";
2023-05-06 10:54:03 +02:00
};
loader.grub.device = "/dev/vda";
2023-05-06 10:54:03 +02:00
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/3ab8f4a7-952c-4b6c-93c6-7b307d5bb88b";
2023-05-06 10:54:03 +02:00
fsType = "btrfs";
options = [ "compress=zstd" "discard" "noatime" "ssd" ]; # for some reason, the kernel assumes rotational
2023-05-06 10:54:03 +02:00
};
"/boot" = {
device = "/dev/disk/by-uuid/97aec56b-5fea-4445-83dc-4a20dcf482ce";
2023-05-06 10:54:03 +02:00
fsType = "ext2";
};
};
zramSwap = {
enable = true;
memoryPercent = 150;
};
networking = {
useDHCP = false;
usePredictableInterfaceNames = false;
};
systemd.network = {
enable = true;
networks = {
eth0 = {
name = "eth0";
DHCP = "yes";
2023-12-28 23:27:34 +01:00
domains = [ "sbruder.de" ];
2023-05-06 10:54:03 +02:00
};
};
};
}