{ config, pkgs, lib, disko, ... }:
{
  imports = [
    ./hardware.nix
    ./disks.nix
  ];

  sydnix = {
    filesystemType = "btrfs";

    users.users = [
      "lain"
    ];
  };

  boot.loader = {
    systemd-boot.enable = true;
    efi.canTouchEfiVariables = true;
  };

  time.timeZone = "America/Denver";

  i18n.defaultLocale = "en_US.UTF-8";

  console = {
    font = "Lat2-Terminus16";
    # keyMap = "us";
    useXkbConfig = true; # use xkb.options in tty.
  };

  fileSystems."/persist/dots" = {
    device = "mount-dots";
    fsType = "virtiofs";
    mountPoint = "/persist/dots";
  };

  services.xserver.xkb.layout = "us";
  services.xserver.xkb.options = "caps:escape";

  hardware.graphics = {
    enable = true;
    enable32Bit = true;
  };

  services.desktopManager.plasma6.enable = true;
    
  environment.systemPackages = with pkgs; [
    neovim
    git
    waypipe
    (let scripts = ["port-tools" "sydnix-cli"];
     in map (s: import ../../scripts/${s} { inherit pkgs; })
         scripts)
  ];

  services.openssh = {
    enable = true;
    settings = {
      PermitRootLogin = "yes";
      X11Forwarding = true;
      # This server is connected to the internet!  Port 22 is open!!
      # Aagghhhh!!!  Stay safe!
      PasswordAuthentication = false;
    };
  };

  # TODO: Move to defaults.
  users.mutableUsers = false;

  nix = {
    settings = {
      trusted-users = [
        "@wheel"
      ];
      substituters = [
        "https://nix-community.cachix.org"
        "https://cache.nixos.org"
      ];
      trusted-public-keys = [
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
    };
  };

  # This option defines the first version of NixOS you have installed on this
  # particular machine, and is used to maintain compatibility with application
  # data (e.g. databases) created on older NixOS versions.
  #
  # Most users should NEVER change this value after the initial install, for any
  # reason, even if you've upgraded your system to a new NixOS release.
  #
  # This value does NOT affect the Nixpkgs version your packages and OS are
  # pulled from, so changing it will NOT upgrade your system - see
  # https://nixos.org/manual/nixos/stable/#sec-upgrading for how to actually do
  # that.
  #
  # This value being lower than the current NixOS release does NOT mean your
  # system is out of date, out of support, or vulnerable.
  #
  # Do NOT change this value unless you have manually inspected all the changes
  # it would make to your configuration, and migrated your data accordingly.
  #
  # For more information, see `man configuration.nix` or
  # https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
  system.stateVersion = "24.05"; # Did you read the comment?
}
