# Basic NIX modules.
{ config, pkgs, ... }:

/* Option definitions */
{
  system.stateVersion = "23.11";

  # Bootloader.
  boot.loader.grub = {
    enable = true;
    device = "/dev/sda";
    useOSProber = false;
  };

  # Localization.
  console.keyMap = "us";
  time.timeZone = "Europe/Amsterdam";
  i18n.defaultLocale = "en_US.UTF-8";
  i18n.extraLocaleSettings = {
    LC_ADDRESS = "nl_NL.UTF-8";
    LC_IDENTIFICATION = "nl_NL.UTF-8";
    LC_MEASUREMENT = "nl_NL.UTF-8";
    LC_MONETARY = "nl_NL.UTF-8";
    LC_NAME = "nl_NL.UTF-8";
    LC_NUMERIC = "nl_NL.UTF-8";
    LC_PAPER = "nl_NL.UTF-8";
    LC_TELEPHONE = "nl_NL.UTF-8";
    LC_TIME = "nl_NL.UTF-8";
  };

  # Networking.
  networking.hostName = "nixos-vm";

  ## SSH.
  # Automatically opens port 22 in the firewall.
  services.openssh.enable = true;

  # Package management.
  nixpkgs.config.allowUnfree = true;
  environment.systemPackages = with pkgs; [
    git
    tmux
    vim
  ];

  # SUID wrappers.
  programs.mtr.enable = true;
  programs.gnupg.agent = {
    enable = true;
    enableSSHSupport = true;
  };

  # Users.
  users.users.mike = {
    isNormalUser = true;
    description = "Mike Wazowski";
    extraGroups = [
      "networkmanager"
      "wheel"
    ];
    packages = with pkgs; [
      chezmoi
      firefox
      kate
      lefthook
      # thunderbird
      vscode
    ];
  };

  # Include external configuration files.
  imports = [
    ./hardware-configuration.nix  # usually autogenerated by the system
    ./kde.nix
    ./k3s.nix
  ];
}
