Files
nix-config/outputs/x86_64-linux/tests/idols-aquamarine/expr.nix
T
Ryan Yin eaa53004e5 fix(aquamarine): install only clr's OpenCL ICD instead of the openvino-gpu wrapper
hardware.amdgpu.opencl.enable also adds clr, whose OpenCL 2.2 libOpenCL.so.1
lands in /run/opengl-driver/lib, first in OpenVINO's RUNPATH, and shadows the
ocl-icd loader the GPU plugin links. With clr.icd alone the plugin finds
ocl-icd, so the wrapper and WA-038 go.

Assisted-by: Claude Code (claude-opus-5-5)
2026-11-01 11:55:14 -06:00

114 lines
4.9 KiB
Nix

{
myvars,
outputs,
lib,
...
}:
let
eval = outputs.nixosConfigurations.aquamarine;
cfg = eval.config;
inherit (myvars.networking.hostsAddr.aquamarine) ipv4;
in
{
# A server configuration is named after the bare hostname (no `-niri`).
hostNameIsBare = cfg.networking.hostName == "aquamarine";
# The two Radeon AI PRO R9700 cards: driver and the IOMMU mode ROCm needs for multi-GPU.
amdgpuDriverLoaded = builtins.elem "amdgpu" cfg.boot.kernelModules;
iommuPassthrough = builtins.elem "iommu=pt" cfg.boot.kernelParams;
# This board's ACPI firmware cannot power the dGPU back on, and amdgpu throws
# the error away, so the card dies on its first idle resume (./ROCM.md, WA-032).
runtimePmDisabled = builtins.elem "amdgpu.runpm=0" cfg.boot.kernelParams;
# An unattended host recovers a hung card itself instead of waiting for a reboot.
gpuRecoveryEnabled = builtins.elem "amdgpu.gpu_recovery=1" cfg.boot.kernelParams;
deepCStatesAllowed = !(builtins.elem "processor.max_cstate=2" cfg.boot.kernelParams);
cpuEppConfigured =
lib.attrByPath [
"devices"
"system"
"cpu"
"cpu[0-9]*"
"cpufreq"
"energy_performance_preference"
] null cfg.boot.kernel.sysfs == "balance_power";
# Aqua uses native IPv6; the gateway returns real AAAA records instead of
# requiring a host-local IPv4 precedence workaround.
nativeIpv6Preference =
!(cfg.environment.etc ? "gai.conf")
|| !lib.hasInfix "precedence ::ffff:0:0/96 100" cfg.environment.etc."gai.conf".text;
# The Strata checkout lives under ~/src, which has to survive the tmpfs root
# like ~/codes does.
sourceCheckoutsPersistent = builtins.any (
d: d.directory == "/home/${myvars.username}/src"
) cfg.preservation.preserveAt."/persistent".users.${myvars.username}.directories;
# A cold flake cache re-downloads the input of a `nix run <flake-ref>` at boot.
cachePersistent = builtins.any (
d: d.directory == "/home/${myvars.username}/.cache"
) cfg.preservation.preserveAt."/persistent".users.${myvars.username}.directories;
# Directories the tmpfs root would otherwise drop.
userUnitDirsPersistent =
let
dirs = cfg.preservation.preserveAt."/persistent".users.${myvars.username}.directories;
in
builtins.all (path: builtins.any (d: d.directory == "/home/${myvars.username}/${path}") dirs) [
".config/systemd/user"
".config/containers/systemd"
];
rootlessPodmanEnabled = cfg.virtualisation.podman.enable;
latestKernel =
cfg.boot.kernelPackages.kernel.version == eval.pkgs.linuxPackages_latest.kernel.version;
btopShowsRadeon = cfg.modules.btop.package == eval.pkgs.btop-rocm;
# CAP_PERFMON inside the wrapper is what the i915 iGPU needs.
btopReadsIgpu = cfg.modules.btop.perfmon;
# The iGPU takes video work off the R9700s: VA-API, oneVPL and OpenCL/Level-Zero.
igpuMediaStackInstalled =
let
packageNames = map (package: package.pname or "") (cfg.hardware.graphics.extraPackages or [ ]);
in
builtins.all (name: builtins.elem name packageNames) [
"intel-media-driver"
"vpl-gpu-rt"
"intel-compute-runtime"
];
rocmOpenclIcdOnly =
let
graphics = cfg.hardware.graphics.extraPackages;
in
builtins.elem eval.pkgs.rocmPackages.clr.icd graphics
&& !builtins.elem eval.pkgs.rocmPackages.clr graphics;
gpuMetricsExported = builtins.elem "drm" cfg.services.prometheus.exporters.node.enabledCollectors;
raplMetricsExported = builtins.elem "rapl" cfg.services.prometheus.exporters.node.enabledCollectors;
raplPermissionsExposed = lib.hasInfix "chgrp rapl" cfg.services.udev.extraRules;
# node_exporter rejects a repeated flag, and this list merges with the base
# module's entries, so a duplicate restart-loops the unit.
collectorFlagsUnique =
builtins.length (cfg.services.prometheus.exporters.node.enabledCollectors)
== builtins.length (lib.unique cfg.services.prometheus.exporters.node.enabledCollectors);
inferenceUserCanRender = builtins.elem "render" cfg.users.users.${myvars.username}.extraGroups;
# Headless: no desktop session, no Home Manager.
noHomeManager = !cfg ? home-manager.users;
pythonInstalled = builtins.any (
package: lib.hasPrefix "python3-" (package.name or "")
) cfg.environment.systemPackages;
# The board renames the wired NIC with the PCIe topology, so networkd matches the
# `en*` prefix; a name-based match leaves the host without an address.
staticAddressMatchesWiredInterface =
builtins.elem "${ipv4}/24" cfg.systemd.network.networks."10-lan".networkConfig.Address
&& cfg.systemd.network.networks."10-lan".matchConfig.Name == [ "en*" ];
# Ephemeral root with the persistent volume required at boot, as on `ai`.
rootIsTmpfs = cfg.fileSystems."/".fsType or null == "tmpfs";
stateIsPersistent = cfg.fileSystems."/persistent".neededForBoot or false;
# Install step 4 of ./README.md depends on this mapper name staying put.
luksMapperNamed = builtins.attrNames cfg.boot.initrd.luks.devices == [ "aqua-luks" ];
}