Nix configurations for my homelab
at main 2.8 kB view raw
1{ 2 lib, 3 pkgs, 4 modulesPath, 5 ... 6}: 7{ 8 imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; 9 10 boot = { 11 initrd = { 12 availableKernelModules = [ 13 "xhci_pci" 14 "ahci" 15 "nvme" 16 "usbhid" 17 "usb_storage" 18 "sd_mod" 19 ]; 20 kernelModules = [ ]; 21 }; 22 kernel = { 23 sysctl."vm.max_map_count" = 2147483642; 24 sysfs.module.zswap.parameters = { 25 accept_threshold_percent = 90; 26 compressor = "zstd"; 27 enabled = "Y"; 28 max_pool_percent = 50; 29 shrinker_enabled = "N"; 30 zpool = "zsmalloc"; 31 }; 32 }; 33 kernelModules = [ "kvm-intel" ]; 34 kernelPackages = pkgs.linuxPackages_latest; 35 kernelPatches = [ ]; 36 loader = { 37 efi.canTouchEfiVariables = true; 38 systemd-boot = { 39 configurationLimit = 50; 40 consoleMode = "auto"; 41 enable = true; 42 }; 43 timeout = 0; 44 }; 45 supportedFilesystems = [ "ntfs" ]; 46 tmp.useTmpfs = true; 47 }; 48 49 fileSystems = 50 let 51 disk-uuid = "/dev/disk/by-uuid/7bf830d4-189d-4e9b-bcb0-565f4ac69e67"; 52 in 53 { 54 "/" = { 55 device = "none"; 56 fsType = "tmpfs"; 57 options = [ 58 "defaults" 59 "mode=755" 60 ]; 61 }; 62 "/data" = { 63 device = disk-uuid; 64 fsType = "btrfs"; 65 options = [ 66 "subvol=@nixos/data" 67 "compress=zstd" 68 "discard=async" 69 ]; 70 neededForBoot = true; 71 }; 72 "/nix" = { 73 device = disk-uuid; 74 fsType = "btrfs"; 75 options = [ 76 "subvol=@nixos/nix" 77 "compress=zstd" 78 "discard=async" 79 ]; 80 }; 81 "/config" = { 82 device = disk-uuid; 83 fsType = "btrfs"; 84 options = [ 85 "subvol=@nixos/config" 86 "compress=zstd" 87 "discard=async" 88 ]; 89 }; 90 "/swap" = { 91 device = disk-uuid; 92 fsType = "btrfs"; 93 options = [ "subvol=@swap" ]; 94 }; 95 "/boot" = { 96 device = "/dev/disk/by-uuid/862D-85DB"; 97 fsType = "vfat"; 98 options = [ 99 "fmask=0077" 100 "dmask=0077" 101 "defaults" 102 ]; 103 }; 104 }; 105 106 swapDevices = [ { device = "/swap/swapfile"; } ]; 107 108 hardware = { 109 amdgpu.opencl.enable = true; 110 enableRedistributableFirmware = true; 111 bluetooth = { 112 enable = true; 113 powerOnBoot = true; 114 }; 115 cpu.intel.updateMicrocode = true; 116 uinput.enable = true; 117 graphics = { 118 enable = true; 119 enable32Bit = true; 120 extraPackages = with pkgs; [ 121 intel-compute-runtime 122 intel-media-driver 123 vpl-gpu-rt 124 ]; 125 }; 126 }; 127 128 powerManagement.cpuFreqGovernor = "performance"; 129 networking.useDHCP = lib.mkDefault true; 130 nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 131}