Compare commits

...

5 Commits

Author SHA1 Message Date
Simon Bruder 8e4a6cc060
hitagi: Reinstall in VM 2024-03-19 17:10:38 +01:00
Simon Bruder 7cb1698467
fixup! fixup! fixup! WIP: hyper: Init 2024-03-19 17:10:34 +01:00
Simon Bruder 45b9cd304d
fixup! fixup! WIP: hyper: Init 2024-03-19 16:57:03 +01:00
Simon Bruder d23daad7c6
fixup! WIP: hyper: Init 2024-03-19 16:53:08 +01:00
Simon Bruder acb07155ad
WIP: hyper: Init 2024-03-19 16:53:07 +01:00
6 changed files with 275 additions and 80 deletions

View File

@ -76,4 +76,9 @@ in
targetHost = "yuzuru.sbruder.de";
};
hyper = {
system = "x86_64-linux";
targetHost = "hyper.lan.shinonome-lab.de";
};
}

View File

@ -5,56 +5,33 @@
{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
# Intel arc
kernelPackages = pkgs.linuxPackages_latest;
# fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8
kernelModules = [ "kvm-amd" "it87" ];
kernelParams = [ "acpi_enforce_resources=lax" ]; # allow it87 to load
extraModulePackages = with config.boot.kernelPackages; [ it87 ];
extraModprobeConfig = ''
options it87 force_id=0x8688
'';
loader = {
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "virtio_blk" ];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
root = {
name = "root";
device = "/dev/disk/by-uuid/63c6aa7c-47c5-43f5-b0eb-c32b0768327b";
preLVM = true;
allowDiscards = true;
};
};
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/3994f497-9848-459e-9642-cbc14a7d3c97";
device = "/dev/disk/by-uuid/db6c8826-ea3c-4bd6-bcb3-5a9ae3089519";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
options = [ "discard=async" "noatime" "compress=zstd" "ssd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/96B6-34BD";
device = "/dev/disk/by-uuid/77DB-CC39";
fsType = "vfat";
};
};
swapDevices = [
{ device = "/dev/disk/by-uuid/98de7ced-4d7c-4915-bf5b-1a0300458ea6"; }
];
# GPU
hardware.opengl = {
package = pkgs.mesa.drivers;
@ -81,57 +58,4 @@
capabilities = "cap_perfmon+p";
source = "${pkgs.intel-gpu-tools}/bin/intel_gpu_top";
};
# https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
systemd.services.suspend-fix = {
wantedBy = [ "multi-user.target" ];
description = "Fix suspend";
script = ''
if grep -q "GPP0 .* \*enabled" /proc/acpi/wakeup; then
echo GPP0 > /proc/acpi/wakeup
echo "Disabled wakeup for GPP0"
else
echo "Wakeup for GPP0 already disabled"
fi
'';
serviceConfig = {
Type = "oneshot";
};
};
sbruder.fancontrol = {
enable = false; # no hwmon for intel arc (yet)
enableDefaultMapping = true;
fans = {
front = {
pwmFile = "/sys/class/hwmon/hwmon1/pwm4";
rpmFile = "/sys/class/hwmon/hwmon1/fan4_input";
pwmLineStart = 50;
neverStop = true;
};
back = {
pwmFile = "/sys/class/hwmon/hwmon1/pwm2";
rpmFile = "/sys/class/hwmon/hwmon1/fan2_input";
};
};
sensors = {
cpu = {
file = "/sys/class/hwmon/hwmon2/temp3_input";
min = 50;
max = 80;
};
gpu = {
file = "/sys/class/hwmon/hwmon4/temp1_input";
min = 50;
max = 70;
};
nvme = {
file = "/sys/class/hwmon/hwmon0/temp1_input";
min = 40;
max = 70;
};
};
};
}

39
machines/hyper/README.md Normal file
View File

@ -0,0 +1,39 @@
<!--
SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
SPDX-License-Identifier: CC-BY-SA-4.0
-->
# hitagi
## Hardware
Custom build in a be quiet! Pure Base 500
with the front panel changed to a Pure Base 500DXs (for better airflow).
* Motherboard: GIGABYTE B550 AORUS ELITE V2 (rev 1.0)
* CPU: AMD Ryzen 7 5800X
* RAM:
2×16GB G.Skill Aegis F4-3200C16-16GIS
\+ 2×32GB G.Skill Ripjaws V F4-3200C16-32GVK
(both DDR4 3200MHz CL16-18-18-38)
* PSU: be quiet! System Power 10 750W
* SSD: 1TB Samsung 980 Pro NVMe
* GPU: Intel Arc A770 Limited Edition (16GB VRAM)
* Case fans: 2 be quiet! Pure Wings 2 140mm (included in case), 3 more with PWM
* CPU Cooler: Noctua NH-U12S with an additional NF-F12 PWM
This replaces sayuri,
which features an enterprise HP firmware without fan control,
an ancient Intel platform that is only usable in YOLO mode (`mitigations=off`)
and proprietary case, motherboard and power supply.
## Purpose
Tasks that require large amounts of CPU power,
a high amount of GPU power
or have to run while I do other things (on my laptop).
## Name
Senjougahara Hitagi is a student from the *Monogatari Series*.

View File

@ -0,0 +1,63 @@
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./network.nix
../../modules
];
networking.hostName = "hyper";
system.stateVersion = "23.11";
virtualisation.libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
ovmf.enable = true;
};
};
environment.systemPackages = with pkgs; [
virtiofsd
];
fileSystems = {
"/data/shared" = {
device = "/dev/hyper-vg/shared";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
};
#environment.etc."libvirt/hooks/qemu".source = pkgs.writeShellScript "libvirt-qemu-hook" ''
# set -euo pipefail
# object="$1"
# operation="$2"
# sub_operation="$3"
# extra_arg="$4"
# intel_arc_reset_hack_guests=(
# "virtdows"
# )
# case "$operation" in
# start)
# if [ "$sub_operation" = "begin" ]; then
# for guest in "''${intel_arc_reset_hack_guests[@]}"; do
# if [ "$guest" = "$object" ]; then
# echo "Applied intel arc reset hack for guest $guest"
# echo > /sys/bus/pci/devices/0000:08:00.0/reset_method
# fi
# done
# fi
# ;;
# esac
#'';
}

View File

@ -0,0 +1,81 @@
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
# fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8
kernelModules = [ "kvm-amd" "it87" ];
kernelParams = [
"acpi_enforce_resources=lax" # allow it87 to load
"ip=dhcp"
"iommu=pt"
"default_hugepagesz=1G"
"hugepagesz=1G"
"hugepages=90"
];
extraModulePackages = with config.boot.kernelPackages; [ it87 ];
extraModprobeConfig = ''
options it87 force_id=0x8688
options vfio-pci ids=8086:56a0,8086:4f90
softdep drm pre: vfio-pci
options kvm-amd nested=0 avic=1 npt=1
'';
loader = {
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "r8169" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
root = {
name = "root";
device = "/dev/disk/by-uuid/63d366bd-5453-46b5-89d5-a61cbb828102";
preLVM = true;
allowDiscards = true;
};
};
};
};
# https://www.reddit.com/r/gigabyte/comments/p5ewjn/b550i_pro_ax_f13_bios_sleep_issue_on_linux/
systemd.services.suspend-fix = {
wantedBy = [ "multi-user.target" ];
description = "Fix suspend";
script = ''
if grep -q "GPP0 .* \*enabled" /proc/acpi/wakeup; then
echo GPP0 > /proc/acpi/wakeup
echo "Disabled wakeup for GPP0"
else
echo "Wakeup for GPP0 already disabled"
fi
'';
serviceConfig = {
Type = "oneshot";
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/53f4e762-39fa-41a6-8b78-4999d38e6e88";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/403C-02C1";
fsType = "vfat";
};
};
}

View File

@ -0,0 +1,83 @@
# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ lib, ... }:
let
vlans = {
lan = 10;
guest = 30;
};
dhcpVlans = [ "lan" ];
in
{
networking.useDHCP = false;
systemd.network = {
enable = true;
wait-online.extraArgs = [ "--any" ];
netdevs =
let
vlanNetdevs = (lib.mapAttrs
(Name: Id: {
netdevConfig = {
inherit Name;
Kind = "vlan";
};
vlanConfig = {
inherit Id;
};
})
vlans);
bridgeNetdevs = (lib.mapAttrs'
(name: _: lib.nameValuePair "br-${name}" {
netdevConfig = {
Name = "br-${name}";
Kind = "bridge";
};
})
vlans);
in
lib.mkMerge [ vlanNetdevs bridgeNetdevs ];
networks =
let
vlanNetworks = (lib.mapAttrs
(name: _: {
inherit name;
matchConfig = {
Type = "vlan";
};
bridge = lib.singleton "br-${name}";
})
vlans);
bridgeNetworks = (lib.mapAttrs'
(name: _: lib.nameValuePair "br-${name}"
({
name = "br-${name}";
} // lib.optionalAttrs (lib.elem name dhcpVlans) {
DHCP = "ipv4";
networkConfig = {
IPv6AcceptRA = "yes";
};
}))
vlans);
in
lib.mkMerge [
{
physical-lan = {
name = "eno1";
vlan = [ "lan" "guest" ];
networkConfig = {
LinkLocalAddressing = "no";
LLDP = "no";
EmitLLDP = "no";
IPv6AcceptRA = "no";
IPv6SendRA = "no";
};
};
}
vlanNetworks
bridgeNetworks
];
};
}