{ inputs, config, lib, pkgs, modulesPath, hostname, ... }: {
  imports = [ 
    inputs.nixos-hardware.nixosModules.raspberry-pi-4
    (modulesPath + "/installer/scan/not-detected.nix")
    ../../common/services/tailscale-autoconnect.nix
    ./backup-script.nix
    ./cron.nix
    ./wireguard.nix
  ];
  # Enable distributed Builds
  nix.distributedBuilds = true;

  hardware = {
    raspberry-pi."4".apply-overlays-dtmerge.enable = true;
    deviceTree = {
      enable = true;
      filter = "*rpi-4-*.dtb";
    };
  };
  console.enable = true;
  environment.systemPackages = with pkgs; [
    libraspberrypi
    raspberrypi-eeprom
  ];
  
  # Set your time zone.
  time.timeZone = "Asia/Tokyo";

  #####################################################################################
  # BEGIN hardware config
  #####################################################################################

  # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
  boot.loader.grub.enable = false;
  # Enables the generation of /boot/extlinux/extlinux.conf
  boot.loader.generic-extlinux-compatible.enable = true;

  boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ ];
  boot.extraModulePackages = [ ];

  fileSystems."/" = { 
    device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
    fsType = "ext4";
  };

  swapDevices = [ ];
  networking.useDHCP = lib.mkDefault true;
  powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
  networking.hostName = "backups-rpi4";
  #####################################################################################
  # END hardware config
  #####################################################################################

  services.tailscale.extraUpFlags = [ "--advertise-exit-node" ];
  boot.kernel.sysctl = { "net.ipv4.ip_forward" = true; };
}