{
  config,
  pkgs,
  lib,
  ...
}: let
  mkUser = {
    userName,
    uid,
  }: {
    isNormalUser = true;
    home = "/home/${userName}";
    initialPassword = "password";
    extraGroups = ["wheel" "networkmanager" "docker" "video" "syncthing"];
    uid = uid;
    group = "users";
    shell = pkgs.zsh;
  };

  defaultUser = {
    userName = "daniel";
    uid = 1000;
  };
in {
  # Use the systemd-boot EFI boot loader.
  boot.kernelPackages = pkgs.linuxPackages_latest;
  boot.loader.systemd-boot.enable = lib.mkDefault true;
  boot.loader.efi.canTouchEfiVariables = lib.mkDefault true;

  # nix flakes compatibility
  nix = {
    extraOptions = ''
      experimental-features = nix-command flakes
      warn-dirty = false
    '';

    settings = {
      substituters = [
        "https://hyprland.cachix.org"
      ];
      trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
      trusted-users = [
        "root"
        "daniel"
      ];
    };
  };

  # Set time zone.
  time.timeZone = "Europe/London";

  i18n = {
    defaultLocale = "en_GB.UTF-8";
  };

  console = {
    useXkbConfig = true;
  };

  virtualisation.docker.enable = true;

  hardware.cpu.intel.updateMicrocode = true;

  users.users."${defaultUser.userName}" = mkUser defaultUser;

  users.groups."users" = {
    gid = 100;
  };

  xdg.portal.wlr.enable = true;
  xdg.portal.config.common.default = "*";

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    curl
    fd
    firefox
    fzf
    gcc
    git
    htop
    helix
    jq
    nnn
    ripgrep
    wget
    zsh
  ];

  environment.homeBinInPath = true;

  environment.variables = {
    EDITOR = "hx";
  };

  networking.firewall.trustedInterfaces = ["tailscale0"];

  programs.zsh.enable = true;
  programs.nm-applet.enable = true;

  services = {
    openssh.enable = true;

    syncthing = {
      enable = true;
      user = defaultUser.userName;
      dataDir = "/home/${defaultUser.userName}";
      overrideDevices = false;
      overrideFolders = false;
    };

    tailscale = {
      enable = true;
    };
  };
}
