forked from jan-leila/nix-config
		
	moved hardware configuration software options to hardware.nix
This commit is contained in:
		
							parent
							
								
									834165443a
								
							
						
					
					
						commit
						2213d099d0
					
				
					 8 changed files with 85 additions and 62 deletions
				
			
		|  | @ -32,11 +32,11 @@ updating passwords: `sops secrets/secrets.yaml` | |||
| 
 | ||||
| ## Tech Debt | ||||
| - allowUnfree should be enabled user side not host side (this isn't enabled at all right now for some reason???) | ||||
| - Move configs for pipe mouse, open rgb, and via keyboard to hardware config and install users side from those configs | ||||
| - have nfs binds and exports defined by same code | ||||
| - move services from defiant into own flake | ||||
| - made base domain in nas services configurable | ||||
| - vscode extensions should be in own flake (make sure to add the nixpkgs.overlays in it too) | ||||
| - server service system users should also be on local systems for file permission reasons | ||||
| ## New Features | ||||
| - GNOME default monitors per hardware configuration? | ||||
| - offline access for nfs mounts (overlay with rsync might be a good option here? https://www.spinics.net/lists/linux-unionfs/msg07105.html note about nfs4 and overlay fs) | ||||
|  |  | |||
|  | @ -4,8 +4,9 @@ | |||
| { config, lib, pkgs, modulesPath, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = | ||||
|     [ (modulesPath + "/installer/scan/not-detected.nix") | ||||
|   imports = [ | ||||
|     (modulesPath + "/installer/scan/not-detected.nix") | ||||
|     ../hardware-common.nix | ||||
|   ]; | ||||
| 
 | ||||
|   boot = { | ||||
|  | @ -41,5 +42,8 @@ | |||
|   }; | ||||
| 
 | ||||
|   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||
|   hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
|   hardware = { | ||||
|     # TODO: hardware graphics | ||||
|     cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										16
									
								
								hosts/hardware-common.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								hosts/hardware-common.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| { lib, ... }: | ||||
| { | ||||
|   options = { | ||||
|     hardware = { | ||||
|       piperMouse = { | ||||
|         enable = lib.mkEnableOption "host has a piper mouse"; | ||||
|       }; | ||||
|       viaKeyboard = { | ||||
|         enable = lib.mkEnableOption "host has a via keyboard"; | ||||
|       }; | ||||
|       openRGB = { | ||||
|         enable = lib.mkEnableOption "host has open rgb hardware"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | @ -4,8 +4,9 @@ | |||
| { config, lib, pkgs, modulesPath, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = | ||||
|     [ (modulesPath + "/installer/scan/not-detected.nix") | ||||
|   imports = [ | ||||
|     (modulesPath + "/installer/scan/not-detected.nix") | ||||
|     ../hardware-common.nix | ||||
|   ]; | ||||
| 
 | ||||
|   boot = { | ||||
|  | @ -23,9 +24,6 @@ | |||
|     }; | ||||
|   }; | ||||
| 
 | ||||
| 
 | ||||
|   hardware.graphics.enable = true; | ||||
| 
 | ||||
|   fileSystems = { | ||||
|     "/" = | ||||
|       { device = "/dev/disk/by-uuid/866d422b-f816-4ad9-9846-791839cb9337"; | ||||
|  | @ -100,5 +98,10 @@ | |||
| 
 | ||||
|   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||
|   powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; | ||||
|   hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
| 
 | ||||
| 
 | ||||
|   hardware = { | ||||
|     graphics.enable = true; | ||||
|     cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
|   }; | ||||
| } | ||||
|  |  | |||
|  | @ -14,9 +14,6 @@ | |||
|   users = { | ||||
|     leyla = { | ||||
|       isFullUser = true; | ||||
|       hasPiperMouse = true; | ||||
|       hasOpenRGBHardware = true; | ||||
|       hasViaKeyboard = true; | ||||
|       hasGPU = true; | ||||
|     }; | ||||
|     ester.isFullUser = true; | ||||
|  |  | |||
|  | @ -4,8 +4,9 @@ | |||
| { config, lib, pkgs, modulesPath, ... }: | ||||
| 
 | ||||
| { | ||||
|   imports = | ||||
|     [ (modulesPath + "/installer/scan/not-detected.nix") | ||||
|   imports = [ | ||||
|     (modulesPath + "/installer/scan/not-detected.nix") | ||||
|     ../hardware-common.nix | ||||
|   ]; | ||||
| 
 | ||||
|   boot = { | ||||
|  | @ -31,43 +32,6 @@ | |||
|     displayManager.gdm.wayland = false; | ||||
|   }; | ||||
| 
 | ||||
|   hardware = { | ||||
|     # Enable OpenGL | ||||
|     graphics.enable = true; | ||||
|      | ||||
|     # install graphics drivers | ||||
|     nvidia = { | ||||
|       # Modesetting is required. | ||||
|       modesetting.enable = true; | ||||
| 
 | ||||
|       # Nvidia power management. Experimental, and can cause sleep/suspend to fail. | ||||
|       # Enable this if you have graphical corruption issues or application crashes after waking | ||||
|       # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead  | ||||
|       # of just the bare essentials. | ||||
|       powerManagement.enable = false; | ||||
| 
 | ||||
|       # Fine-grained power management. Turns off GPU when not in use. | ||||
|       # Experimental and only works on modern Nvidia GPUs (Turing or newer). | ||||
|       powerManagement.finegrained = false; | ||||
| 
 | ||||
|       # Use the NVidia open source kernel module (not to be confused with the | ||||
|       # independent third-party "nouveau" open source driver). | ||||
|       # Support is limited to the Turing and later architectures. Full list of  | ||||
|       # supported GPUs is at:  | ||||
|       # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus  | ||||
|       # Only available from driver 515.43.04+ | ||||
|       # Currently alpha-quality/buggy, so false is currently the recommended setting. | ||||
|       open = false; | ||||
| 
 | ||||
|       # Enable the Nvidia settings menu, | ||||
|     # accessible via `nvidia-settings`. | ||||
|       nvidiaSettings = true; | ||||
| 
 | ||||
|       # Optionally, you may need to select the appropriate driver version for your specific GPU. | ||||
|       package = config.boot.kernelPackages.nvidiaPackages.production; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   fileSystems = { | ||||
|     "/" = | ||||
|       { device = "/dev/disk/by-uuid/8be49c65-2b57-48f1-b74d-244d26061adb"; | ||||
|  | @ -114,6 +78,48 @@ | |||
|   }; | ||||
| 
 | ||||
|   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||
|   hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
| 
 | ||||
|   hardware = { | ||||
|     piperMouse.enable = true; | ||||
|     viaKeyboard.enable = true; | ||||
|     openRGB.enable = true; | ||||
| 
 | ||||
|     # Enable OpenGL | ||||
|     graphics.enable = true; | ||||
|      | ||||
|     # install graphics drivers | ||||
|     nvidia = { | ||||
|       # Modesetting is required. | ||||
|       modesetting.enable = true; | ||||
| 
 | ||||
|       # Nvidia power management. Experimental, and can cause sleep/suspend to fail. | ||||
|       # Enable this if you have graphical corruption issues or application crashes after waking | ||||
|       # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead  | ||||
|       # of just the bare essentials. | ||||
|       powerManagement.enable = false; | ||||
| 
 | ||||
|       # Fine-grained power management. Turns off GPU when not in use. | ||||
|       # Experimental and only works on modern Nvidia GPUs (Turing or newer). | ||||
|       powerManagement.finegrained = false; | ||||
| 
 | ||||
|       # Use the NVidia open source kernel module (not to be confused with the | ||||
|       # independent third-party "nouveau" open source driver). | ||||
|       # Support is limited to the Turing and later architectures. Full list of  | ||||
|       # supported GPUs is at:  | ||||
|       # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus  | ||||
|       # Only available from driver 515.43.04+ | ||||
|       # Currently alpha-quality/buggy, so false is currently the recommended setting. | ||||
|       open = false; | ||||
| 
 | ||||
|       # Enable the Nvidia settings menu, | ||||
|     # accessible via `nvidia-settings`. | ||||
|       nvidiaSettings = true; | ||||
| 
 | ||||
|       # Optionally, you may need to select the appropriate driver version for your specific GPU. | ||||
|       package = config.boot.kernelPackages.nvidiaPackages.production; | ||||
|     }; | ||||
| 
 | ||||
|     cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,9 +10,6 @@ in | |||
|   options.users.leyla = { | ||||
|     isFullUser = lib.mkEnableOption "create usable leyla user"; | ||||
|     isThinUser = lib.mkEnableOption "create usable user but witohut user applications"; | ||||
|     hasPiperMouse = lib.mkEnableOption "install programs for managing piper supported mouses"; | ||||
|     hasOpenRGBHardware = lib.mkEnableOption "install programs for managing openRGB supported hardware"; | ||||
|     hasViaKeyboard = lib.mkEnableOption "install programs for managing via supported keyboards"; | ||||
|     hasGPU = lib.mkEnableOption "installs gpu intensive programs"; | ||||
|   }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -118,9 +118,9 @@ in | |||
|             noisetorch | ||||
| 
 | ||||
|             # hardware managment tools | ||||
|             (lib.mkIf cfg.hasPiperMouse piper) | ||||
|             (lib.mkIf cfg.hasOpenRGBHardware openrgb) | ||||
|             (lib.mkIf cfg.hasViaKeyboard via) | ||||
|             (lib.mkIf config.hardware.piperMouse.enable piper) | ||||
|             (lib.mkIf config.hardware.openRGB.enable openrgb) | ||||
|             (lib.mkIf config.hardware.viaKeyboard.enable via) | ||||
|           ] | ||||
|         ) | ||||
|       ) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue