{
  pkgs,
  inputs,
  lib,
  ...
}:
{
  imports = [
    "${inputs.self}/modules/mizukios/base"
    "${inputs.self}/modules/mizukios/features/system/boot.nix"
    "${inputs.self}/modules/mizukios/features/remote/ssh.nix"
    "${inputs.self}/modules/mizukios/features/management/docker.nix"
    ./services/mailserver.nix
    ./services/caddy.nix
  ];

  # Override shared boot.nix for Legacy BIOS
  boot.loader.grub.enableCryptodisk = lib.mkForce false;

  services.netbird.enable = true;

  users.users.imnyang.openssh.authorizedKeys.keys = [
    "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOHP3Z+AYrRh9f8TYyqChKfeyNm3lOe0F75AwRHTTaxD imnyang@kazusa"
    "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIrpjEYOBx7LTGb7QsPrmPBboqyTUNm/e+4+yqWruljv imnyang@natsu"
  ];

  environment.systemPackages = with pkgs; [
    eza
    neovim
    nil
    nixd
    bun
  ];

  boot.kernel.sysctl = {
    "net.ipv4.ip_forward" = 1;
    "net.ipv6.conf.all.forwarding" = 1;
  };

  programs.git.config = {
    safe.directory = "*";
  };

  networking = {
    hostName = "kazusa";
    domain = "icn.mizuki.guru";
    nameservers = [
      "1.1.1.1"
      "1.0.0.1"
      "9.9.9.9"
      "149.112.112.112"
    ];
    useDHCP = false;
    dhcpcd.enable = false;
    interfaces.ens18 = {
      ipv4.addresses = [
        {
          address = "82.21.82.30";
          prefixLength = 24;
        }
      ];
    };
    defaultGateway = {
      address = "82.21.82.1";
      interface = "ens18";
    };
  };

  networking.firewall.allowedTCPPorts = [
    22
    80
    443
  ];

  systemd.services.gnaynmi = {
    description = "discord bot";
    after = [ "network-online.target" ];
    wants = [ "network-online.target" ];
    wantedBy = [ "multi-user.target" ];

    serviceConfig = {
      Type = "simple";
      User = "imnyang";
      WorkingDirectory = "/home/imnyang/gnaynmi";
      EnvironmentFile = "/home/imnyang/gnaynmi/.env";
      ExecStart = "${pkgs.bun}/bin/bun run src/index.ts";
      Restart = "always";
      RestartSec = 5;
    };

    path = [
      pkgs.bun
      pkgs.stdenv.cc.cc.lib
    ];
    environment = {
      LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
    };
  };

  services.qemuGuest.enable = true;

  system.stateVersion = "26.05";
}
