{ config, pkgs, lib, disko, sydnix-cli, modulesPath, ... }:

{
  imports = [
    (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix")

    # Provide an initial copy of the NixOS channel so that the user
    # doesn't need to run "nix-channel --update" first.
    (modulesPath + "/installer/cd-dvd/channel.nix")
  ];
    
  time.timeZone = "America/Denver";

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

  services.xserver.xkb = {
    layout = "us";
    options = "ctrl:swapcaps";
  };

  services.openssh = {
    enable = true;
    settings = {
      PermitRootLogin = "yes";
      X11Forwarding = true;
    };
  };

  users.users.nixos = {
    uid = 1000;
    isNormalUser = true;
    openssh.authorizedKeys.keyFiles = [
      ../../public-keys/ssh/crumb-at-guix-rebound.pub
      ../../public-keys/ssh/crumb-at-nixos-testbed.pub
      ../../public-keys/ssh/crumble-at-fruitbook.pub
      ../../public-keys/ssh/lain-at-deertopia.pub
    ];
    password = "pswd";
    initialHashedPassword = lib.mkForce null;
    initialPassword = lib.mkForce null;
    hashedPassword = lib.mkForce null;
  };

  users.users.root = {
    password = "pswd";
    initialHashedPassword = lib.mkForce null;
    initialPassword = lib.mkForce null;
    hashedPassword = lib.mkForce null;
  };

  environment.systemPackages =
    let
      my-vimrc =
        pkgs.writeTextFile {
          name = "vimrc";
          text = ''
            imap jk <ESC>
            xmap JK <ESC>
            set number
            set relativenumber
            let mapleader=" "
            nmap <Leader>w <C-w>
            set splitright
          '';
        };

      my-neovim =
        pkgs.symlinkJoin {
          name = "neovim";
          paths = [ pkgs.neovim ];
          buildInputs = [ pkgs.makeWrapper ];
          postBuild = ''
            wrapProgram $out/bin/nvim \
              --add-flags "-u ${my-vimrc}"
            # Symlink {v,vi,vim} to nvim.
            for i in {v,vi,vim}; do
              ln -s $out/bin/nvim $out/bin/$i
            done
          '';
        };
    in [ my-neovim ];

  # 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?
}
