mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 22:11:33 +01:00
Move hardware config files into directory
This commit is contained in:
parent
cb3daa129c
commit
fa4d802536
7 changed files with 2 additions and 2 deletions
58
hosts/north/hardware/default.nix
Normal file
58
hosts/north/hardware/default.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.disko.nixosModules.default
|
||||
./disko.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
|
||||
hardware = {
|
||||
enableRedistributableFirmware = true;
|
||||
cpu.amd.updateMicrocode = true;
|
||||
};
|
||||
|
||||
boot = {
|
||||
kernelModules = [
|
||||
"kvm-amd"
|
||||
"k10temp"
|
||||
"nct6775"
|
||||
];
|
||||
initrd.availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"nvme"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"sd_mod"
|
||||
];
|
||||
};
|
||||
|
||||
zramSwap.enable = true;
|
||||
hardware.logitech.lcd.enable = true;
|
||||
services = {
|
||||
fstrim.enable = true;
|
||||
|
||||
# Prevent immediate wake-up from suspend caused by the logi bolt receiver
|
||||
udev.extraRules = ''
|
||||
ACTION=="add" SUBSYSTEM=="pci" ATTR{vendor}=="0x1022" ATTR{device}=="0x43ee" ATTR{power/wakeup}="disabled"
|
||||
'';
|
||||
};
|
||||
|
||||
hardware.fancontrol = {
|
||||
enable = true;
|
||||
config = ''
|
||||
# pwm1=rear pwm2=cpu pwm3=front+top pwm4=gpu pwm=motherboard?
|
||||
INTERVAL=2
|
||||
DEVPATH=hwmon1=devices/pci0000:00/0000:00:18.3 hwmon2=devices/platform/nct6775.656
|
||||
DEVNAME=hwmon1=k10temp hwmon2=nct6798
|
||||
FCTEMPS=hwmon2/pwm1=hwmon2/temp1_input hwmon2/pwm2=hwmon1/temp1_input hwmon2/pwm3=hwmon2/temp1_input hwmon2/pwm4=/tmp/nvidia-gpu-temp
|
||||
FCFANS=hwmon2/pwm1=hwmon2/fan1_input hwmon2/pwm2=hwmon2/fan7_input+hwmon2/fan2_input hwmon2/pwm3=hwmon2/fan3_input hwmon2/pwm4=hwmon2/fan4_input
|
||||
MINTEMP=hwmon2/pwm1=35 hwmon2/pwm2=45 hwmon2/pwm3=35 hwmon2/pwm4=40
|
||||
MAXTEMP=hwmon2/pwm1=100 hwmon2/pwm2=100 hwmon2/pwm3=100 hwmon2/pwm4=100
|
||||
MINSTART=hwmon2/pwm1=16 hwmon2/pwm2=16 hwmon2/pwm3=16 hwmon2/pwm4=30
|
||||
MINSTOP=hwmon2/pwm1=16 hwmon2/pwm2=16 hwmon2/pwm3=16 hwmon2/pwm4=30
|
||||
'';
|
||||
};
|
||||
}
|
||||
28
hosts/north/hardware/disko.nix
Normal file
28
hosts/north/hardware/disko.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
disko.devices.disk.main = {
|
||||
device = "/dev/nvme0n1";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
type = "EF00";
|
||||
size = "500M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
hosts/north/hardware/nvidia.nix
Normal file
28
hosts/north/hardware/nvidia.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.latest;
|
||||
};
|
||||
|
||||
systemd.services.gpu-temp-reader = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "fancontrol.service" ];
|
||||
before = [ "fancontrol.service" ];
|
||||
script = ''
|
||||
${lib.getExe' pkgs.coreutils "touch"} /tmp/nvidia-gpu-temp
|
||||
while :; do
|
||||
temp="$(${lib.getExe' config.hardware.nvidia.package "nvidia-smi"} --query-gpu=temperature.gpu --format=csv,noheader,nounits)"
|
||||
${lib.getExe' pkgs.coreutils "echo"} "$((temp * 1000))" > /tmp/nvidia-gpu-temp
|
||||
${lib.getExe' pkgs.coreutils "sleep"} 2
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue