documentation

This commit is contained in:
theArctesian
2025-09-25 07:50:48 -07:00
parent 85e493eb54
commit d8947e67b7
41 changed files with 4405 additions and 538 deletions
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
# Unix-style system checker - does one thing well
set -e
# Check if running on NixOS
check_nixos() {
[ -f /etc/NIXOS ] || {
echo "Not running on NixOS" >&2
exit 1
}
}
# Check permissions (warn if root, but don't block)
check_permissions() {
if [ "$EUID" -eq 0 ]; then
echo "Warning: Running as root is not recommended" >&2
return 1
fi
return 0
}
# Main check
main() {
case "${1:-}" in
--nixos-only)
check_nixos
;;
--permissions-only)
check_permissions
;;
--quiet|-q)
check_nixos >/dev/null 2>&1
check_permissions >/dev/null 2>&1
;;
*)
check_nixos
check_permissions || true # Don't exit on root warning
;;
esac
# Output status for scripting
if [[ "${OMNIXY_JSON:-}" == "1" ]]; then
echo '{"nixos": true, "root": '$([ "$EUID" -eq 0 ] && echo "true" || echo "false")'}'
fi
}
main "$@"