Commit 6a2a90329521
Changed files (6)
systems/okinawa/boot.nix
@@ -0,0 +1,41 @@
+{ pkgs, ... }:
+{
+ boot = {
+ loader = {
+ systemd-boot = {
+ enable = true;
+ netbootxyz.enable = true;
+ configurationLimit = 10;
+ };
+ efi.canTouchEfiVariables = true;
+ };
+
+ # Latest kernel for best AMD support
+ kernelPackages = pkgs.linuxPackages_latest;
+
+ # Kernel modules for AMD hardware
+ initrd.availableKernelModules = [
+ "nvme"
+ "xhci_pci"
+ "thunderbolt"
+ "usb_storage"
+ "sd_mod"
+ "rtsx_pci_sdmmc"
+ ];
+
+ kernelModules = [ "kvm-amd" ];
+
+ # Basic kernel parameters
+ kernelParams = [
+ # Optional: Deep sleep if you do use suspend occasionally
+ # "mem_sleep_default=deep"
+ ];
+
+ # Blacklist unnecessary wireless modules
+ blacklistedKernelModules = [
+ "sierra_net"
+ "cdc_mbim"
+ "cdc_ncm"
+ ];
+ };
+}
systems/okinawa/disks.nix
@@ -0,0 +1,46 @@
+_: {
+ disko.devices = {
+ disk = {
+ root = {
+ type = "disk";
+ device = "/dev/nvme0n1";
+ content = {
+ type = "gpt";
+ partitions = {
+ ESP = {
+ size = "1G";
+ type = "EF00";
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ mountOptions = [ "umask=0077" ];
+ };
+ };
+ root = {
+ size = "100%";
+ content = {
+ type = "luks";
+ name = "cryptroot";
+ askPassword = true;
+ settings = {
+ allowDiscards = true;
+ };
+ content = {
+ type = "filesystem";
+ format = "ext4";
+ mountpoint = "/";
+ mountOptions = [
+ "noatime"
+ "nodiratime"
+ "discard"
+ ];
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+}
systems/okinawa/extra.nix
@@ -0,0 +1,94 @@
+{
+ config,
+ pkgs,
+ lib,
+ libx,
+ globals,
+ ...
+}:
+{
+ imports = [
+ ../common/programs/direnv.nix
+ ../common/programs/git.nix
+ ../common/programs/nix-ld.nix
+ ../common/programs/tmux.nix
+ ../common/services/containers.nix
+ ../common/services/docker.nix
+ ../common/services/prometheus-exporters-node.nix
+ ];
+
+ # Wireguard VPN
+ services.wireguard = {
+ enable = true;
+ ips = libx.wg-ips globals.machines.okinawa.net.vpn.ips;
+ endpoint = "${globals.net.vpn.endpoint}";
+ endpointPublicKey = "${globals.machines.kerkouane.net.vpn.pubkey}";
+ };
+
+ # Ollama for local LLM inference with dGPU
+ services.ollama = {
+ enable = true;
+ package = pkgs.ollama-rocm; # ROCm support for AMD GPU
+ host = "0.0.0.0";
+ port = 11434;
+
+ # Models optimized for 8GB VRAM (RX 6700S)
+ loadModels = [
+ # Coding models
+ "qwen2.5-coder:7b" # Best coding: 88.4% HumanEval (~20-30 tok/s)
+ "codestral" # Latest coding (Jan 2025): 86.6% HumanEval (~8-10 tok/s)
+
+ # Reasoning models
+ "phi4-reasoning" # Best 14B reasoning (~6-10 tok/s, tight on 8GB)
+
+ # Multimodal
+ "qwen2.5vl:7b" # Vision + text (~15-20 tok/s)
+
+ # General purpose
+ "llama3.1:8b" # Native tool support (~20-25 tok/s)
+ "phi3.5:3.8b" # Ultra-fast for quick tasks (~30-40 tok/s)
+ ];
+
+ environmentVariables = {
+ # Critical: RX 6700S (gfx1032) needs this override
+ HSA_OVERRIDE_GFX_VERSION = "10.3.0";
+ OLLAMA_KEEP_ALIVE = "10m";
+ OLLAMA_NUM_PARALLEL = "1";
+ };
+ };
+
+ # ROCm environment variables
+ environment.variables = {
+ HSA_OVERRIDE_GFX_VERSION = "10.3.0";
+ };
+
+ # System packages for LLM work
+ environment.systemPackages = with pkgs; [
+ # LLM tools
+ (llama-cpp.override {
+ vulkanSupport = true;
+ rocmSupport = true;
+ })
+
+ # GPU monitoring and management
+ radeontop # GPU usage monitor
+ clinfo # Check OpenCL
+ vulkan-tools # vulkaninfo
+ rocmPackages.rocminfo
+ asusctl # CLI for supergfxctl
+
+ # Development
+ python3
+ uv
+ ];
+
+ # Prometheus node exporter (configured in common module)
+ # Port and basic collectors already set in ../common/services/prometheus-exporters-node.nix
+
+ # Lid handling: ignore (desktop replacement, mostly on AC)
+ services.logind.settings.Login = {
+ HandleLidSwitch = "ignore";
+ HandleLidSwitchExternalPower = "ignore";
+ HandleLidSwitchDocked = "ignore";
+ };
+}
systems/okinawa/hardware.nix
@@ -0,0 +1,71 @@
+{
+ inputs,
+ lib,
+ pkgs,
+ ...
+}:
+{
+ imports = [
+ inputs.disko.nixosModules.disko
+ (import ./disks.nix { inherit lib; })
+
+ # nixos-hardware module for GA402X (AMD GPU)
+ inputs.nixos-hardware.nixosModules.asus-zephyrus-ga402x-amdgpu
+
+ # ASUS battery module (for charge limiting)
+ inputs.nixos-hardware.nixosModules.asus-battery
+
+ # Common modules
+ ../common/hardware/laptop.nix
+ ../common/hardware/acpid.nix
+ ../common/hardware/bluetooth.nix
+ ];
+
+ # Swapfile on root partition (8GB for 32GB RAM system)
+ swapDevices = [
+ {
+ device = "/swapfile";
+ size = 8 * 1024; # 8GB
+ }
+ ];
+
+ hardware = {
+ enableAllFirmware = true;
+
+ # AMD GPU configuration (works for both iGPU and dGPU)
+ # RADV (Mesa Vulkan) is enabled by default
+ graphics = {
+ enable = true;
+ extraPackages = with pkgs; [
+ rocmPackages.clr.icd # OpenCL/ROCm support
+ ];
+ };
+
+ # Battery charge limit (even on AC, good for battery longevity)
+ asus.battery.chargeUpto = 80;
+ };
+
+ services = {
+ # ASUS services
+ asusd = {
+ enable = true;
+ enableUserService = true;
+ };
+
+ # supergfxd: GPU switching service
+ # Will be set to "dedicated" mode for dGPU-only operation
+ supergfxd.enable = true;
+
+ # Power management
+ power-profiles-daemon.enable = true;
+
+ # Firmware updates
+ fwupd.enable = true;
+
+ # Disk monitoring
+ smartd = {
+ enable = true;
+ devices = [ { device = "/dev/nvme0n1"; } ];
+ };
+ };
+}
flake.nix
@@ -74,6 +74,11 @@
# desktop = "sway";
desktop = "niri";
};
+ # Laptop for LLM workloads (unstable)
+ okinawa = libx.mkHost {
+ hostname = "okinawa";
+ desktop = "niri"; # or "sway"
+ };
# Servers (unstable)
aomi = libx.mkHost {
hostname = "aomi";
globals.nix
@@ -492,7 +492,7 @@ _: {
net = {
ips = [ "192.168.1.19" ];
vpn = {
- # pubkey = "";
+ pubkey = "REPLACE-AFTER-INSTALL"; # From: sudo wg show wg0 public-key
ips = [ "10.100.0.14" ];
};
names = [
@@ -501,13 +501,19 @@ _: {
"okinawa.sbr.pm"
];
};
- # syncthing = {
- # id = "2RWT47Z-UGSH4QO-G4W6XN7-3XY722R-ZKGDN5U-4MDGHMA-6SM26QM-7VCQIAZ";
- # folders = {
- # sync = { };
- # org = { };
- # };
- # };
+ ssh = {
+ hostKey = "REPLACE-AFTER-INSTALL"; # From: cat /etc/ssh/ssh_host_ed25519_key.pub
+ };
+ syncthing = {
+ id = "REPLACE-AFTER-INSTALL"; # From Syncthing UI (http://localhost:8384)
+ folders = {
+ sync = { };
+ org = { };
+ documents = { };
+ ai-sync = { };
+ claude-sync = { };
+ };
+ };
};
# iPhone
hokkaido = {