{ config, lib, pkgs, ... }:

{
  system.stateVersion = "22.05";

  boot = {
    loader = {
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = true;
    };
    initrd = {
      availableKernelModules =
        [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
      kernelModules = [ ];
    };
    kernelModules = [ "kvm-amd" ];
    extraModulePackages = [ ];
  };

  fileSystems = {
    "/" = {
      device = "toothless-root";
      fsType = "tmpfs";
      options = [ "mode=755" "noexec" ];
    };

    "/boot" = {
      device = "/dev/disk/by-label/TOOTH-BOOT";
      fsType = "vfat";
      options = [ "noatime" "noexec" ];
    };

    "/nix" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "subvol=@nix" "noatime" "compress=zstd" ];
    };

    "/state" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "subvol=@state" "noatime" "compress=zstd" "noexec" ];
    };

    "/home" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "subvol=@home" "noatime" "compress=zstd" "noexec" ];
    };

    "/var/log" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "subvol=@log" "noatime" "compress=zstd" "noexec" ];
    };

    "/var/lib/tailscale" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "noexec" "subvol=@tailscale" ];
    };

    "/var/lib/containers" = {
      device = "/dev/disk/by-label/toothless-data";
      fsType = "btrfs";
      options = [ "noatime" "compress=zstd" "noexec" "subvol=@containers" ];
    };
  };

  swapDevices = [{ device = "/dev/disk/by-label/toothless-swap"; }];

  hardware = {
    enableAllFirmware = true;
    cpu.amd.updateMicrocode = true;
  };

  networking = {
    useDHCP = false;
    macvlans = {
      intif0 = {
        interface = "enp6s0";
        mode = "bridge";
      };
    };
    interfaces.intif0.macAddress = "02:ee:76:17:99:ed";
  };
}