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

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