nix machine / user configurations
1{ 2 config, 3 lib, 4 tlib, 5 pkgs, 6 inputs, 7 ... 8}: 9{ 10 imports = 11 with inputs; 12 with nixos-hardware.nixosModules; 13 [ 14 # vfio.nixosModules.kvmfr 15 # vfio.nixosModules.virtualisation 16 # vfio.nixosModules.vfio 17 # vfio.nixosModules.libvirtd 18 agenix.nixosModules.default 19 nixpkgs.nixosModules.notDetected 20 nixos-persistence.nixosModule 21 common-pc-ssd 22 common-pc-laptop 23 common-gpu-nvidia 24 common-gpu-amd 25 common-cpu-amd 26 common-cpu-amd-pstate 27 ../../users/root 28 ../../users/patriot 29 ] 30 ++ (tlib.importFolder (toString ./modules)); 31 32 system.persistDir = "/persist"; 33 34 nix.settings.max-jobs = lib.mkForce 16; 35 security = { 36 pam.loginLimits = [ 37 { 38 domain = "*"; 39 type = "soft"; 40 item = "nofile"; 41 value = "16777216"; 42 } 43 { 44 domain = "*"; 45 type = "hard"; 46 item = "nofile"; 47 value = "16777216"; 48 } 49 ]; 50 allowSimultaneousMultithreading = true; 51 # Deleting root subvolume makes sudo show lecture every boot 52 sudo.extraConfig = '' 53 Defaults lecture = never 54 ''; 55 rtkit.enable = true; 56 }; 57 58 sound.enable = false; 59 services.pipewire = { 60 enable = true; 61 alsa.enable = true; 62 alsa.support32Bit = true; 63 pulse.enable = true; 64 jack.enable = true; 65 }; 66 hardware.pulseaudio = { 67 enable = false; 68 support32Bit = true; 69 }; 70 71 services.xserver.videoDrivers = [ 72 "nvidia" 73 "amdgpu" 74 ]; 75 hardware = { 76 nvidia = { 77 package = config.boot.kernelPackages.nvidiaPackages.production; 78 modesetting.enable = true; 79 powerManagement.enable = false; 80 powerManagement.finegrained = true; 81 open = false; 82 nvidiaSettings = true; 83 prime = { 84 offload = { 85 enable = true; 86 enableOffloadCmd = true; 87 }; 88 amdgpuBusId = "PCI:5:0:0"; 89 nvidiaBusId = "PCI:1:0:0"; 90 }; 91 }; 92 opengl = { 93 driSupport = true; 94 driSupport32Bit = true; 95 enable = true; 96 extraPackages = with pkgs; [ 97 libvdpau-va-gl 98 vaapiVdpau 99 libva 100 vulkan-loader 101 ]; 102 extraPackages32 = with pkgs.pkgsi686Linux; [ 103 libvdpau-va-gl 104 vaapiVdpau 105 libva 106 vulkan-loader 107 ]; 108 }; 109 }; 110 111 hardware = { 112 bluetooth.enable = true; 113 }; 114 115 programs.light.enable = true; 116 117 fonts = { 118 enableDefaultPackages = true; 119 fontconfig.enable = true; 120 packages = [ pkgs.dejavu_fonts ]; 121 }; 122 123 environment = { 124 sessionVariables.FLAKE = "/etc/nixos"; 125 pathsToLink = [ "/share/zsh" ]; 126 persistence."${config.system.persistDir}" = { 127 directories = lib.flatten [ 128 "/etc/nixos" 129 (lib.optional config.virtualisation.docker.enable [ 130 "/var/lib/docker" 131 "/var/lib/containers" 132 ]) 133 ]; 134 files = [ "/etc/machine-id" ]; 135 }; 136 }; 137 138 # warframe 139 networking.firewall.allowedUDPPorts = [ 140 4990 141 4991 142 4992 143 4993 144 4994 145 4995 146 ]; 147 # musikcube 148 networking.firewall.allowedTCPPorts = [ 149 7905 150 7906 151 ] 152 ++ [ 153 6695 154 6696 155 6697 156 6698 157 6699 158 ] 159 ++ [ 50300 ]; 160 161 # for tailscale 162 networking.firewall.checkReversePath = "loose"; 163 services.tailscale.enable = true; 164 165 services = { 166 earlyoom.enable = true; 167 gvfs.enable = true; 168 }; 169 170 system.stateVersion = "22.05"; 171}