#! /nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash
# shellcheck shell=bash

case "$1" in
  -h|--help)
    exec man nixos-version
    exit 1
    ;;
  --hash|--revision)
    if ! [[ 2fad6eac6077f03fe109c4d4eb171cf96791faa4 =~ ^[0-9a-f]+$ ]]; then
      echo "$0: Nixpkgs commit hash is unknown" >&2
      exit 1
    fi
    echo "2fad6eac6077f03fe109c4d4eb171cf96791faa4"
    ;;
  --configuration-revision)
    if [[ "@configurationRevision@" =~ "@" ]]; then
      echo "$0: configuration revision is unknown" >&2
      exit 1
    fi
    echo "@configurationRevision@"
    ;;
  --json)
    cat <<EOF
{"nixosVersion":"26.05pre903292.2fad6eac6077","nixpkgsRevision":"2fad6eac6077f03fe109c4d4eb171cf96791faa4"}
EOF
    ;;
  *)
    echo "26.05pre903292.2fad6eac6077 (Yarara)"
    ;;
esac
