Files
Foundry/hosts/nixos/maia/hardware-configuration.nix
T
2026-08-06 09:53:42 -03:00

111 lines
2.7 KiB
Nix

{inputs, pkgs, ...}: {
imports = [
inputs.disko.nixosModules.disko
../common/optional/ephemeral-btrfs.nix
];
nixpkgs.hostPlatform.system = "x86_64-linux";
boot.binfmt.emulatedSystems = [
"aarch64-linux"
"i686-linux"
];
hardware.cpu.amd.updateMicrocode = true;
powerManagement.cpuFreqGovernor = "ondemand";
boot = {
initrd = {
availableKernelModules = [
"nvme"
"xhci_pci"
"thunderbolt"
"usb_storage"
"sd_mod"
];
kernelModules = ["kvm-amd"];
};
loader = {
systemd-boot = {
enable = true;
consoleMode = "max";
};
efi.canTouchEfiVariables = true;
};
};
disko.devices.disk.main = {
device = "/dev/nvme0n1";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
esp = {
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
luks = {
size = "100%";
content = {
name = "root";
type = "luks";
settings.allowDiscards = true;
content = {
type = "btrfs";
postCreateHook = ''
MNTPOINT=$(mktemp -d)
mount -t btrfs "$device" "$MNTPOINT"
trap 'umount $MNTPOINT; rm -d $MNTPOINT' EXIT
btrfs subvolume snapshot -r $MNTPOINT/root $MNTPOINT/root-blank
'';
subvolumes = {
"/root" = {
mountOptions = ["compress=zstd"];
mountpoint = "/";
};
"/nix" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/nix";
};
"/persist" = {
mountOptions = ["compress=zstd"];
mountpoint = "/persist";
};
"/swap" = {
mountOptions = ["compress=zstd" "noatime"];
mountpoint = "/swap";
swap.swapfile = {
size = "16384M";
path = "swapfile";
};
};
};
};
};
};
};
};
};
hardware.acpilight.enable = true;
environment.systemPackages = [pkgs.brightnessctl];
# Lid settings
services.logind = {
lidSwitch = "suspend";
lidSwitchExternalPower = "lock";
powerKey = "suspend";
powerKeyLongPress = "poweroff";
};
hardware.graphics.enable = true;
}