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

80 lines
2 KiB
Nix
Raw Permalink Normal View History

2024-05-11 21:14:17 +02:00
# SPDX-FileCopyrightText: 2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
swraid.enable = true;
2024-08-20 23:05:02 +02:00
kernelModules = [ "kvm-amd" "nct6775" ];
2024-05-11 21:14:17 +02:00
kernelParams = [ "ip=dhcp" ];
loader = {
grub = {
devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
};
};
initrd = {
2024-08-20 23:05:02 +02:00
availableKernelModules = [ "aesni_intel" "ahci" "igb" "nvme" ];
2024-05-11 21:14:17 +02:00
kernelModules = [ "dm-snapshot" ];
network.enable = true; # remote unlocking
luks.devices = {
koyomi-pv = {
name = "koyomi-pv";
2024-08-20 23:05:02 +02:00
device = "/dev/disk/by-uuid/4907ad59-e6cf-40ed-a0ff-3dc09c0c7a50";
2024-05-11 21:14:17 +02:00
preLVM = true;
allowDiscards = true;
};
};
# FIXME XXX HACK
# This is required to have the md device available under /dev/disk/by-uuid.
# Both commands are run as part of the regular stage-1 init script,
# but for some reason, they need to be run twice.
preLVMCommands = ''
udevadm trigger
udevadm settle
'';
};
};
fileSystems = {
"/" = {
2024-08-20 23:05:02 +02:00
device = "/dev/disk/by-uuid/4b4efa64-e571-4937-bb1c-7608e9d7630d";
2024-05-11 21:14:17 +02:00
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
"/boot" = {
2024-08-20 23:05:02 +02:00
device = "/dev/disk/by-uuid/83e67d66-ec76-4c9f-8796-1165cdb5362d";
fsType = "ext2";
2024-05-11 21:14:17 +02:00
};
};
2024-05-25 16:13:03 +02:00
services.prometheus.exporters.smartctl.devices = [ "/dev/nvme0n1" "/dev/nvme1n1" ];
2024-08-20 03:17:43 +02:00
# Not used for boot, but required to make thin LVs work
services.lvm.boot.thin.enable = true;
2024-08-20 03:17:58 +02:00
# TODO Enable periodic RAID scrubbing/checking with mdcheck
2024-05-11 21:14:17 +02:00
networking.useDHCP = false;
networking.usePredictableInterfaceNames = false;
systemd.network = {
enable = true;
networks = {
eth0 = {
name = "eth0";
DHCP = "yes";
domains = [ "sbruder.de" ];
2024-08-20 23:05:02 +02:00
address = [ "2a01:4f9:3051:39c6::1/64" ];
2024-05-11 21:14:17 +02:00
gateway = [ "fe80::1" ];
};
};
};
}