Compare commits
	
		
			2 commits
		
	
	
		
			411b55cb24
			...
			99bb1e74c7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 99bb1e74c7 | |||
| ca0c093ecd | 
					 7 changed files with 65 additions and 36 deletions
				
			
		
							
								
								
									
										37
									
								
								hosts/monolith/amdgpu.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								hosts/monolith/amdgpu.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					{ pkgs, ... }:
 | 
				
			||||||
 | 
					let
 | 
				
			||||||
 | 
					  undervoltGpu = pkgs.writeShellScript "undervolt-gpu" ''
 | 
				
			||||||
 | 
					    set -xe
 | 
				
			||||||
 | 
					    cd $1
 | 
				
			||||||
 | 
					    echo "manual" > power_dpm_force_performance_level
 | 
				
			||||||
 | 
					    echo "1" > pp_power_profile_mode
 | 
				
			||||||
 | 
					    test -e pp_od_clk_voltage
 | 
				
			||||||
 | 
					    echo "vo -120" > pp_od_clk_voltage
 | 
				
			||||||
 | 
					    echo "c" > pp_od_clk_voltage
 | 
				
			||||||
 | 
					  '';
 | 
				
			||||||
 | 
					in
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  boot.initrd.kernelModules = [ "amdgpu" ];
 | 
				
			||||||
 | 
					  boot.kernelParams = [
 | 
				
			||||||
 | 
					    "amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
 | 
				
			||||||
 | 
					    "video=DP-1:1920x1080@144"
 | 
				
			||||||
 | 
					    "amdgpu.ppfeaturemask=0xfffd7fff" # enable undervolting
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  hardware.opengl.driSupport = true;
 | 
				
			||||||
 | 
					  # # For 32 bit applications
 | 
				
			||||||
 | 
					  hardware.opengl.driSupport32Bit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  hardware.opengl.extraPackages = with pkgs; [
 | 
				
			||||||
 | 
					    libva
 | 
				
			||||||
 | 
					    libvdpau
 | 
				
			||||||
 | 
					    vaapiVdpau
 | 
				
			||||||
 | 
					    rocm-opencl-icd
 | 
				
			||||||
 | 
					    rocm-opencl-runtime
 | 
				
			||||||
 | 
					    rocmPackages.rocm-smi
 | 
				
			||||||
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  services.udev.extraRules = ''
 | 
				
			||||||
 | 
					    ACTION=="add", SUBSYSTEM=="hwmon", ATTR{name}=="amdgpu", ATTR{power1_cap}="186000000", RUN+="${undervoltGpu} %S%p/device"
 | 
				
			||||||
 | 
					  '';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -23,7 +23,7 @@ in
 | 
				
			||||||
  imports = [
 | 
					  imports = [
 | 
				
			||||||
    (modulesPath + "/installer/scan/not-detected.nix")
 | 
					    (modulesPath + "/installer/scan/not-detected.nix")
 | 
				
			||||||
    ./partition.nix
 | 
					    ./partition.nix
 | 
				
			||||||
    ./undervolt.nix
 | 
					    ./amdgpu.nix
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
  boot.initrd.availableKernelModules = [
 | 
					  boot.initrd.availableKernelModules = [
 | 
				
			||||||
    "nvme"
 | 
					    "nvme"
 | 
				
			||||||
| 
						 | 
					@ -52,28 +52,12 @@ in
 | 
				
			||||||
    "amdgpu"
 | 
					    "amdgpu"
 | 
				
			||||||
    "zenpower"
 | 
					    "zenpower"
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
  boot.kernelParams = [
 | 
					
 | 
				
			||||||
    "amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
 | 
					 | 
				
			||||||
    "video=DP-1:1920x1080@144"
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
  systemd.sleep.extraConfig = ''
 | 
					  systemd.sleep.extraConfig = ''
 | 
				
			||||||
    HibernateDelaySec=30s
 | 
					    HibernateDelaySec=30s
 | 
				
			||||||
    SuspendState=mem
 | 
					    SuspendState=mem
 | 
				
			||||||
  '';
 | 
					  '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  hardware.opengl.driSupport = true;
 | 
					 | 
				
			||||||
  # # For 32 bit applications
 | 
					 | 
				
			||||||
  hardware.opengl.driSupport32Bit = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  hardware.opengl.extraPackages = with pkgs; [
 | 
					 | 
				
			||||||
    libva
 | 
					 | 
				
			||||||
    libvdpau
 | 
					 | 
				
			||||||
    vaapiVdpau
 | 
					 | 
				
			||||||
    rocm-opencl-icd
 | 
					 | 
				
			||||||
    rocm-opencl-runtime
 | 
					 | 
				
			||||||
    rocmPackages.rocm-smi
 | 
					 | 
				
			||||||
  ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  fileSystems."/mnt/old" = {
 | 
					  fileSystems."/mnt/old" = {
 | 
				
			||||||
    device = "/dev/disk/by-label/BTRFS_ROOT";
 | 
					    device = "/dev/disk/by-label/BTRFS_ROOT";
 | 
				
			||||||
    fsType = "btrfs";
 | 
					    fsType = "btrfs";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,18 +0,0 @@
 | 
				
			||||||
{ pkgs, ... }:
 | 
					 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  undervoltGpu = pkgs.writeShellScript "undervolt-gpu" ''
 | 
					 | 
				
			||||||
    set -xe
 | 
					 | 
				
			||||||
    cd $1
 | 
					 | 
				
			||||||
    echo "manual" > power_dpm_force_performance_level
 | 
					 | 
				
			||||||
    echo "1" > pp_power_profile_mode
 | 
					 | 
				
			||||||
    test -e pp_od_clk_voltage
 | 
					 | 
				
			||||||
    echo "vo -120" > pp_od_clk_voltage
 | 
					 | 
				
			||||||
    echo "c" > pp_od_clk_voltage
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  boot.kernelParams = [ "amdgpu.ppfeaturemask=0xfffd7fff" ];
 | 
					 | 
				
			||||||
  services.udev.extraRules = ''
 | 
					 | 
				
			||||||
    ACTION=="add", SUBSYSTEM=="hwmon", ATTR{name}=="amdgpu", ATTR{power1_cap}="186000000", RUN+="${undervoltGpu} %S%p/device"
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					@ -21,6 +21,7 @@
 | 
				
			||||||
    ./invidious.nix
 | 
					    ./invidious.nix
 | 
				
			||||||
    ./davi.nix
 | 
					    ./davi.nix
 | 
				
			||||||
    ./goofs.nix
 | 
					    ./goofs.nix
 | 
				
			||||||
 | 
					    ./factorio-server.nix
 | 
				
			||||||
  ];
 | 
					  ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  networking.hostName = "phantom";
 | 
					  networking.hostName = "phantom";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										24
									
								
								hosts/phantom/factorio-server.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								hosts/phantom/factorio-server.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,24 @@
 | 
				
			||||||
 | 
					{ config, pkgs, ... }:
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  services.factorio = {
 | 
				
			||||||
 | 
					    enable = true;
 | 
				
			||||||
 | 
					    package = pkgs.unstable.factorio-headless.overrideAttrs (_: rec {
 | 
				
			||||||
 | 
					      version = "2.0.12";
 | 
				
			||||||
 | 
					      src = pkgs.fetchurl {
 | 
				
			||||||
 | 
					        name = "factorio_headless_x64-${version}.tar.xz";
 | 
				
			||||||
 | 
					        url = "https://www.factorio.com/get-download/${version}/headless/linux64";
 | 
				
			||||||
 | 
					        hash = "sha256-0vgg5eJ6ZEFO0TUixNsByCs8YyPGOArgqnXbT5RIjTE=";
 | 
				
			||||||
 | 
					      };
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    public = true;
 | 
				
			||||||
 | 
					    lan = true;
 | 
				
			||||||
 | 
					    openFirewall = true;
 | 
				
			||||||
 | 
					    admins = [ "lelgenio" ];
 | 
				
			||||||
 | 
					    extraSettingsFile = config.age.secrets.phantom-factorio-settings.path;
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  age.secrets.phantom-factorio-settings = {
 | 
				
			||||||
 | 
					    file = ../../secrets/phantom-factorio-settings.age;
 | 
				
			||||||
 | 
					    mode = "777";
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								secrets/phantom-factorio-settings.age
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								secrets/phantom-factorio-settings.age
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -12,6 +12,7 @@ in
 | 
				
			||||||
  "monolith-forgejo-runner-token.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "monolith-forgejo-runner-token.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
  "lelgenio-cachix.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "lelgenio-cachix.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
  "monolith-nix-serve-privkey.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "monolith-nix-serve-privkey.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
 | 
					  "phantom-factorio-settings.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
  "phantom-nextcloud.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "phantom-nextcloud.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
  "phantom-writefreely.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "phantom-writefreely.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
  "phantom-renawiki.age".publicKeys = [ main_ssh_public_key ];
 | 
					  "phantom-renawiki.age".publicKeys = [ main_ssh_public_key ];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue