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

302 lines
8.6 KiB
Nix
Raw Normal View History

2023-01-07 16:13:39 +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")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" "vfio_virqfd" ];
2023-01-08 12:19:10 +01:00
boot.initrd.secrets = {
"/root/NASKeyfile" =
/root/NASKeyfile;
};
boot.initrd.luks.devices = {
NAS-RAID1 = {
device = "/dev/disk/by-uuid/57e6446d-faca-4b67-9063-e8d9afb80088";
keyFile = "/root/NASKeyfile";
};
NAS-RAID2 = {
device = "/dev/disk/by-uuid/b9edc489-ac37-4b28-981d-442722df7ae2";
keyFile = "/root/NASKeyfile";
};
};
2023-01-07 16:13:39 +01:00
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.tmpOnTmpfs = true;
zramSwap.enable = true;
services.btrfs.autoScrub = {
enable = true;
interval = "monthly";
fileSystems = [
"/"
"/mnt/Pluto"
"/mnt/Mars"
];
};
services.snapper.configs = {
home = {
subvolume = "/home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
mars_home = {
subvolume = "/mnt/Mars/Home";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="5"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_backups = {
subvolume = "/mnt/Pluto/Backups";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="3"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_games = {
subvolume = "/mnt/Pluto/Games";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_it = {
subvolume = "/mnt/Pluto/IT";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="5"hm
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_media = {
subvolume = "/mnt/Pluto/Media";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_pictures = {
subvolume = "/mnt/Pluto/Pictures";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
pluto_rest = {
subvolume = "/mnt/Pluto/Rest";
extraConfig = ''
TIMELINE_CREATE=yes
TIMELINE_CLEANUP=yes
TIMELINE_LIMIT_HOURLY="0"
TIMELINE_LIMIT_DAILY="5"
TIMELINE_LIMIT_WEEKLY="2"
TIMELINE_LIMIT_MONTHLY="2"
TIMELINE_LIMIT_YEARLY="0"
'';
};
};
2023-01-07 16:13:39 +01:00
fileSystems."/" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@,discard=async" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@home,discard=async" ];
};
fileSystems."/home/.snapshots" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@snapshots,discard=async" ];
};
fileSystems."/srv" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
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" ];
};
2023-01-07 19:43:12 +01:00
fileSystems."/mnt/Pluto" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@" ];
};
fileSystems."/mnt/Pluto/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots" ];
};
fileSystems."/mnt/Pluto/Backups/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Backups" ];
};
fileSystems."/mnt/Pluto/Games/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Games" ];
};
fileSystems."/mnt/Pluto/IT/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/IT" ];
};
fileSystems."/mnt/Pluto/Media/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Media" ];
};
fileSystems."/mnt/Pluto/Pictures/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Pictures" ];
};
fileSystems."/mnt/Pluto/Rest/.snapshots" =
{ device = "/dev/disk/by-label/NAS-RAID";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,noatime,subvol=@snapshots/Rest" ];
};
2023-01-07 19:43:12 +01:00
fileSystems."/mnt/Mars" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@nas,discard=async" ];
};
fileSystems."/mnt/Mars/Home/.snapshots" =
{ device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs";
options = [ "compress=zstd,space_cache=v2,ssd,noatime,subvol=@snapshots/mars/Home,discard=async" ];
};
2023-01-07 16:13:39 +01:00
fileSystems."/boot" =
{ device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
};
2023-01-07 19:43:12 +01:00
fileSystems."/export/Pluto" =
{ device = "/mnt/Pluto";
options = [ "bind" ];
};
fileSystems."/export/Mars" =
{ device = "/mnt/Mars";
options = [ "bind" ];
};
fileSystems."/export/Nix" =
{ device = "/nix";
options = [ "bind" ];
};
2023-01-07 19:43:12 +01:00
2023-01-07 16:13:39 +01:00
swapDevices = [ ];
networking = {
useDHCP = false; # Deprecated
hostName = "nas";
2023-01-07 19:43:12 +01:00
domain = "home.opel-online.de";
2023-01-07 16:13:39 +01:00
networkmanager = {
enable = false;
};
interfaces = {
2023-01-07 16:53:36 +01:00
enp0s31f6 = {
2023-01-07 16:13:39 +01:00
useDHCP = true; # 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;
# } ];
2023-01-07 16:53:36 +01:00
};
};
2023-01-07 16:13:39 +01:00
# defaultGateway = "45.142.114.1";
# defaultGateway6 = {
# address = "fe80::1";
# interface = "ens18";
# };
#
# nameservers = [ "9.9.9.9" "2620:fe::fe" ];
};
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
2023-01-08 13:26:55 +01:00
powerManagement = {
cpuFreqGovernor = lib.mkDefault "powersave";
powertop.enable = true;
powerUpCommands = ''
2023-01-13 15:35:07 +01:00
${pkgs.hdparm}/sbin/hdparm -S 150 /dev/disk/by-uuid/57e6446d-faca-4b67-9063-e8d9afb80088
${pkgs.hdparm}/sbin/hdparm -S 150 /dev/disk/by-uuid/b9edc489-ac37-4b28-981d-442722df7ae2
2023-01-08 13:26:55 +01:00
'';
};
2023-01-07 16:13:39 +01:00
}