default:
  @just --list --justfile {{justfile()}}

# Inspect the disk configuration compiled by disko.
[no-cd]
disk-test host:
  #!/usr/bin/env bash
  set -euxo pipefail
  build_path=$(disko --dry-run --flake "$(pwd)#{{host}}" | tail -n 1)
  less $build_path

# Deploys the disk configuration. This will reformat and mount the disk.
[no-cd]
disk host:
  sudo disko --flake "$(pwd)#{{host}}" -m destroy,format,mount

# Mounts the configured disk. Useful for when the disk is already formatted.
[no-cd]
mount host:
  sudo disko --flake "$(pwd)#{{host}}" -m mount

# Installs NixOS onto the drives previously mounted by disko.
[no-cd]
install host:
  #!/usr/bin/env bash
  sudo nixos-install --flake "$(pwd)#{{host}}"

# Deploys the dotfile repository to the host.
[no-cd]
config host user:
  cp -R $(pwd) "/mnt/nix/elements"
  
# send-key:
#  croc send ~/.ssh/id_key

# receive-key phrase:
#  croc {{phrase}}
