{
  self,
  pkgs,
  ...
}:
{
  imports = [
    self.nixosModules.common

    ./hardware-configuration.nix
  ];

  image.modules.sd-card = {
    disabledModules = [
      ./hardware-configuration.nix
    ];
  };

  clan.core.sops.defaultGroups = [ "admins" ];

  nixpkgs.hostPlatform = {
    system = "aarch64-linux";
  };

  system.stateVersion = "25.11";

  services.journald.extraConfig = ''
    Storage=volatile
    RuntimeMaxUse=30M
    RuntimeMaxFileSize=10M
  '';

  services.udisks2.enable = false;

  nix.settings.log-lines = 25;
  nix.settings.auto-optimise-store = true;
  nix.gc = {
    automatic = true;
    dates = "weekly";
    options = "--delete-older-than 15d";
  };

  boot.loader.grub.enable = false;
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.zfs.extraPools = [ "zdata" ];
  boot.supportedFilesystems = [ "zfs" ];
  boot.initrd.availableKernelModules = [
    "usb_storage"
    "sd_mod"
  ];

  fileSystems."/mnt/hdd" = {
    device = "zdata/nas";
    fsType = "zfs";
    mountPoint = "/mnt/hdd";
    options = [
      "nofail"
      "zfsutil"
    ];
  };

  fileSystems."/var/lib" = {
    device = "zdata/service-data";
    fsType = "zfs";
    mountPoint = "/var/lib";
    options = [
      "x-initrd.mount"
      "nofail"
      "zfsutil"
    ];
  };

  systemd.services.heartbeat-push = {
    description = "Heartbeat push to uptime monitor";
    serviceConfig = {
      Type = "oneshot";
      ExecStart = "${pkgs.curl}/bin/curl -s -o /dev/null https://uptime.b4l.co.th/api/push/X0WCHAcY5gPf1U8If7BT1FLjpacZqGZu?status=up&msg=OK&ping=";
    };
  };

  systemd.timers.heartbeat-push = {
    description = "Heartbeat push timer";
    wantedBy = [ "timers.target" ];
    timerConfig = {
      OnBootSec = "60s";
      OnUnitActiveSec = "60s";
      Unit = "heartbeat-push.service";
    };
  };

}
