#
# Automatic first-time setup of the maschine via nix-darwin.
#
# vim: et:ts=2:sw=2:
#
{ config, pkgs, ... }:
let
  username = "deprekated";
in
{

  # Script commands that ensure our system is in a known state.
  # Must be idempotent.
  system.activationScripts.extraActivation.text = ''

    # Install Homebrew
    which /opt/homebrew/bin/brew 2>&1 > /dev/null || sudo -u ${username} /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    # Install Rosetta
    stat /Library/Apple/usr/share/rosetta/rosetta 2>&1 > /dev/null || softwareupdate --install-rosetta

    # Ensure SSH is on.
    systemsetup -setremotelogin on 2>&1 > /dev/null

    # Change shell to xonsh
    chsh -s $(which xonsh) ${username}
  '';
}
