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

74 lines
1.8 KiB
Nix

# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, modulesPath, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
sbruder.machine.isVm = true;
boot = {
kernelModules = [ ];
extraModulePackages = [ ];
kernelParams = [ "ip=dhcp" ];
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "sd_mod" "sr_mod" "virtio_net" "virtio_pci" "xhci_pci" ];
kernelModules = [ ];
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.73.1 dev eth0
ip route add default via 85.215.73.1 dev eth0
'';
};
luks.devices."root".device = "/dev/disk/by-uuid/d166ff83-dcc6-4700-95b5-bffae202d985";
};
loader.grub.device = "/dev/vda";
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/3c91488f-0505-4df6-bf76-96a539dcc27a";
fsType = "btrfs";
options = [ "compress=zstd" "discard" "noatime" "ssd" ]; # for some reason, the kernel assumes rotational
};
"/boot" = {
device = "/dev/disk/by-uuid/f271b335-9174-47a9-bcca-04ce59ce5708";
fsType = "ext2";
};
};
swapDevices = [
{
device = "/dev/disk/by-partuuid/5edbf393-b83e-4d3f-82d1-f07870df40ed";
randomEncryption.enable = true;
}
];
zramSwap = {
enable = true;
memoryPercent = 150;
};
networking = {
useDHCP = false;
usePredictableInterfaceNames = false;
};
systemd.network = {
enable = true;
networks = {
eth0 = {
name = "eth0";
DHCP = "yes";
domains = [ "sbruder.de" ];
};
};
};
}