#! /nix/store/4nmqxajzaf60yjribkgvj5j54x9yvr1r-bash-5.1-p12/bin/bash
# shellcheck shell=bash

case "$1" in
  -h|--help)
    exec man nixos-version
    exit 1
    ;;
  --hash|--revision)
    if ! [[ @revision@ =~ ^[0-9a-f]+$ ]]; then
      echo "$0: Nixpkgs commit hash is unknown"
      exit 1
    fi
    echo "@revision@"
    ;;
  --json)
    cat <<EOF
{"nixosVersion":"22.05.19700101.dirty"}
EOF
    ;;
  *)
    echo "22.05.19700101.dirty (Quokka)"
    ;;
esac
