nixos-config/hosts/server/hardware-configuration.nix

139 lines
3.8 KiB
Nix
Raw Normal View History

2022-11-05 10:25:12 +01:00
#
# Hardware settings for Teclast F5 10" Laptop
# NixOS @ sda2
#
# flake.nix
# └─ ./hosts
# └─ ./laptop
# └─ hardware-configuration.nix *
#
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
2022-11-05 10:25:12 +01:00
];
2022-12-06 22:24:15 +01:00
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "ahci" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
2022-12-06 22:24:15 +01:00
boot.kernelModules = [ "kvm-amd" ];
2022-11-05 10:25:12 +01:00
boot.extraModulePackages = [ ];
2023-09-23 09:19:56 +02:00
boot.tmp.useTmpfs = false;
boot.tmp.cleanOnBoot = true;
2023-01-07 08:56:04 +01:00
zramSwap.enable = true;
2022-11-05 10:25:12 +01:00
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
];
};
2023-01-15 19:12:35 +01:00
services.btrbk = {
instances = {
hf = {
onCalendar = "hourly";
settings = {
incremental = "yes";
snapshot_create = "ondemand";
snapshot_dir = "@snapshots";
timestamp_format = "long";
snapshot_preserve = "2m 2w 5d 5h";
snapshot_preserve_min = "latest";
volume = {
"/mnt/snapshots/root" = {
snapshot_create = "always";
subvolume = {
2023-01-29 11:44:44 +01:00
"@" = {};
2023-01-15 19:12:35 +01:00
"@home" = {};
};
};
};
};
};
};
};
2022-11-05 10:25:12 +01:00
fileSystems."/" =
2022-11-19 21:38:55 +01:00
{ device = "/dev/disk/by-label/NIXROOT";
2022-11-05 10:25:12 +01:00
fsType = "btrfs";
2022-11-19 21:38:55 +01:00
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@,discard=async" ];
2022-11-05 10:25:12 +01:00
};
fileSystems."/home" =
2022-11-19 21:38:55 +01:00
{ device = "/dev/disk/by-label/NIXROOT";
2022-11-05 10:25:12 +01:00
fsType = "btrfs";
2022-11-19 21:38:55 +01:00
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home,discard=async" ];
2022-11-05 10:25:12 +01:00
};
fileSystems."/srv" =
2022-11-19 21:38:55 +01:00
{ device = "/dev/disk/by-label/NIXROOT";
2022-11-05 10:25:12 +01:00
fsType = "btrfs";
2022-11-19 21:38:55 +01:00
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@srv,discard=async" ];
};
fileSystems."/nix" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nix,discard=async" ];
2022-11-05 10:25:12 +01:00
};
2023-09-23 09:19:56 +02:00
fileSystems."/swap" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@swap,discard=async" ];
};
2023-01-15 19:12:35 +01:00
fileSystems."/mnt/snapshots/root" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvolid=5,discard=async" ];
};
2022-11-05 10:25:12 +01:00
2023-10-16 09:29:14 +02:00
#swapDevices = [ { device = "/swap/swapfile"; } ];
swapDevices = [ ];
2022-11-05 10:25:12 +01:00
networking = {
useDHCP = false; # Deprecated
2023-10-16 10:33:47 +02:00
hostName = "kabtop";
2022-12-27 20:14:42 +01:00
domain = "kabtop.de";
2022-11-05 10:25:12 +01:00
networkmanager = {
2022-12-28 16:29:12 +01:00
enable = false;
2022-11-05 10:25:12 +01:00
};
interfaces = {
2022-12-06 22:24:15 +01:00
ens18 = {
useDHCP = false; # For versatility sake, manually edit IP on nm-applet.
ipv4.addresses = [ {
address = "45.142.114.153";
prefixLength = 24;
} ];
ipv6.addresses = [ {
address = "2a00:ccc1:101:19D::2";
prefixLength = 64;
} ];
2022-11-05 10:25:12 +01:00
};
};
2022-12-06 22:24:15 +01:00
defaultGateway = "45.142.114.1";
2022-12-28 16:29:12 +01:00
defaultGateway6 = {
address = "fe80::1";
interface = "ens18";
};
2022-12-06 22:24:15 +01:00
nameservers = [ "9.9.9.9" "2620:fe::fe" ];
firewall = {
enable = true;
allowedUDPPorts = [ ];
2022-12-27 21:15:04 +01:00
allowedTCPPorts = [ 80 443 ];
2022-12-06 22:24:15 +01:00
};
2022-11-05 10:25:12 +01:00
};
2023-11-23 21:54:55 +01:00
#hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
2022-11-05 10:25:12 +01:00
}