#
# Testing:
# doas "$(nix-build '<nixpkgs>' --no-out-link -A 'qemu')/bin/qemu-system-x86_64" \
#      -accel kvm \
#      -cpu host \
#      -smp cores=8 \
#      -m 32768 \
#      -drive "file=$(nix-build '<nixpkgs>' --no-out-link -A 'OVMF.fd')/FV/OVMF.fd,if=pflash,format=raw,readonly=on" \
#      -drive file=/tmp/localdisk.img,if=none,id=nvm,format=raw \
#      -device nvme,serial=deadbeef,drive=nvm \
#      -nic user,hostfwd=tcp::60022-:22 \
#      -boot order=d \
#      -cdrom "$(readlink -f /persist/machine_setup/nix/configuration/result/iso/nixos*.iso)" \
#      -display vnc=127.0.0.1:0
#

{
  config,
  lib,
  pkgs,
  ...
}:
{
  imports = [
    ./wrapped-disk-config.nix
    ./hardware-configuration.nix
  ];

  # Generate with `head -c4 /dev/urandom | od -A none -t x4`
  networking.hostId = "fbd233d8";

  networking.hostName = "ionlybootzfs"; # Define your hostname.

  time.timeZone = "America/New_York";
  i18n.defaultLocale = "en_US.UTF-8";

  me.secureBoot.enable = true;

  me.optimizations = {
    enable = false;
    arch = "znver4";
    system_features = [
      "gccarch-znver4"
      "gccarch-skylake"
      # "gccarch-alderlake" missing WAITPKG
      "gccarch-x86-64-v3"
      "gccarch-x86-64-v4"
      "benchmark"
      "big-parallel"
      "kvm"
      "nixos-test"
    ];
  };

  # Mount tmpfs at /tmp
  boot.tmp.useTmpfs = true;

  me.emacs_flavor = "plainmacs";
  me.graphical = false;
  me.wireguard.activated = [ ];
  me.wireguard.deactivated = [ ];
  me.zsh.enable = true;
}