Compare commits

..

2 commits

Author SHA1 Message Date
Leonardo Eugênio 99bb1e74c7 phantom: add factorio server 2024-10-30 01:45:07 -03:00
Leonardo Eugênio ca0c093ecd monolith: extract amdgpu config 2024-10-30 01:45:07 -03:00
7 changed files with 65 additions and 36 deletions

37
hosts/monolith/amdgpu.nix Normal file
View 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"
'';
}

View file

@ -23,7 +23,7 @@ in
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
./partition.nix
./undervolt.nix
./amdgpu.nix
];
boot.initrd.availableKernelModules = [
"nvme"
@ -52,28 +52,12 @@ in
"amdgpu"
"zenpower"
];
boot.kernelParams = [
"amdgpu.dcdebugmask=0x10" # amdgpu undervolting bug
"video=DP-1:1920x1080@144"
];
systemd.sleep.extraConfig = ''
HibernateDelaySec=30s
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" = {
device = "/dev/disk/by-label/BTRFS_ROOT";
fsType = "btrfs";

View file

@ -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"
'';
}

View file

@ -21,6 +21,7 @@
./invidious.nix
./davi.nix
./goofs.nix
./factorio-server.nix
];
networking.hostName = "phantom";

View 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";
};
}

Binary file not shown.

View file

@ -12,6 +12,7 @@ in
"monolith-forgejo-runner-token.age".publicKeys = [ main_ssh_public_key ];
"lelgenio-cachix.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-writefreely.age".publicKeys = [ main_ssh_public_key ];
"phantom-renawiki.age".publicKeys = [ main_ssh_public_key ];