Something went wrong. Try again.
Sleek — mobile freeq client (Vidya + freeq-sdk)
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159# shellcheck shell=bash# Login/env shim for Codespaces + local SSH.## Source from bashrc (bootstrap installs the hook). When you land in the# sleek workspace after `gh codespace ssh`, this re-execs into `nix develop`# once so cargo/just/rustc match the flake.## Safe to source repeatedly: skips if already in the shell or if nix is missing.
# VNC OAuth browser (safe for non-interactive too)._sleek_env_src_early="${BASH_SOURCE[0]:-}"if [[ -n "$_sleek_env_src_early" ]]; then _sleek_root_early="$(cd "$(dirname "$_sleek_env_src_early")/.." && pwd 2>/dev/null || true)" if [[ -n "${_sleek_root_early:-}" && -x "${_sleek_root_early}/scripts/vnc-browser.sh" ]]; then export BROWSER="${BROWSER:-${_sleek_root_early}/scripts/vnc-browser.sh}" export PATH="${HOME}/.nix-profile/bin:${PATH:-}" fi unset _sleek_root_earlyfiunset _sleek_env_src_early
# Only for interactive shells (not scp/sftp/CI scripts).case $- in *i*) ;; *) return 0 2>/dev/null || exit 0 ;;esac
# Already loaded.if [[ -n "${SLEEK_NIX_SHELL:-}" || -n "${IN_NIX_SHELL:-}" ]]; then return 0 2>/dev/null || truefi
# Resolve repo root: this file lives at scripts/codespace-env.sh_sleek_env_src="${BASH_SOURCE[0]:-}"if [[ -z "$_sleek_env_src" ]]; then return 0 2>/dev/null || truefi_sleek_root="$(cd "$(dirname "$_sleek_env_src")/.." && pwd 2>/dev/null || true)"unset _sleek_env_src
if [[ -z "${_sleek_root:-}" || ! -f "${_sleek_root}/flake.nix" ]]; then unset _sleek_root return 0 2>/dev/null || truefi
# Only auto-enter when cwd is inside the sleek repo (or Codespaces workspace root)._sleek_cwd="$(pwd -P 2>/dev/null || pwd)"case "${_sleek_cwd}/" in "${_sleek_root}/"* | /workspaces/*/) # Codespaces often starts in /workspaces/<name> which is the repo root. if [[ "${_sleek_cwd}" != "${_sleek_root}" && "${_sleek_cwd}"/ != "${_sleek_root}"/* ]]; then # Allow /workspaces/<repo> when it is this checkout. if [[ ! -f "${_sleek_cwd}/flake.nix" ]]; then unset _sleek_root _sleek_cwd return 0 2>/dev/null || true fi _sleek_root="${_sleek_cwd}" fi ;; *) unset _sleek_root _sleek_cwd return 0 2>/dev/null || true ;;esac
# shellcheck disable=SC1091if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then # shellcheck disable=SC1091 . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shelif [[ -f "${HOME}/.nix-profile/etc/profile.d/nix.sh" ]]; then # shellcheck disable=SC1091 . "${HOME}/.nix-profile/etc/profile.d/nix.sh"fiexport PATH="/nix/var/nix/profiles/default/bin:${HOME}/.nix-profile/bin:${PATH}"
# Flakes without flags (user conf + NIX_CONFIG; no sudo required at login).if [[ -f "${_sleek_root}/scripts/ensure-nix-flakes.sh" ]]; then # shellcheck disable=SC1091 . "${_sleek_root}/scripts/ensure-nix-flakes.sh" ensure_nix_flakesfi
# Prefer direnv when available (non-exec path; keeps nested shells happy).if command -v direnv >/dev/null 2>&1 && [[ -f "${_sleek_root}/.envrc" ]]; then # direnv hook should already be in bashrc; force a reload if needed. if [[ -z "${DIRENV_DIR:-}" ]]; then eval "$(cd "${_sleek_root}" && direnv export bash 2>/dev/null)" || true fi if [[ -n "${IN_NIX_SHELL:-}" || -n "${DIRENV_DIR:-}" ]]; then unset _sleek_root _sleek_cwd return 0 2>/dev/null || true fifi
if ! command -v nix >/dev/null 2>&1; then # Soft hint once per shell; do not block login if bootstrap has not run. if [[ -z "${SLEEK_NIX_HINT:-}" ]]; then export SLEEK_NIX_HINT=1 echo "sleek: nix not on PATH — run: bash ${_sleek_root}/scripts/codespace-bootstrap.sh" >&2 fi unset _sleek_root _sleek_cwd return 0 2>/dev/null || truefi
# Opt out: SLEEK_NO_AUTO_NIX=1 gh codespace ssh ...if [[ -n "${SLEEK_NO_AUTO_NIX:-}" ]]; then unset _sleek_root _sleek_cwd return 0 2>/dev/null || truefi
# Multi-user install without daemon: try a quick start, else hint (do not hang login).if [[ -d /nix/var/nix/daemon-socket ]] && [[ ! -S /nix/var/nix/daemon-socket/socket ]]; then if command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then if [[ -x /nix/var/nix/profiles/default/bin/nix-daemon ]]; then sudo bash -c 'setsid /nix/var/nix/profiles/default/bin/nix-daemon --daemon >>/tmp/nix-daemon.log 2>&1 < /dev/null &' 2>/dev/null || true else sudo bash -c 'setsid nix daemon >>/tmp/nix-daemon.log 2>&1 < /dev/null &' 2>/dev/null || true fi _i=0 while [[ $_i -lt 20 && ! -S /nix/var/nix/daemon-socket/socket ]]; do sleep 0.25 _i=$((_i + 1)) done unset _i fifi
if [[ -d /nix/var/nix/daemon-socket ]] && [[ ! -S /nix/var/nix/daemon-socket/socket ]]; then if [[ -z "${SLEEK_NIX_HINT:-}" ]]; then export SLEEK_NIX_HINT=1 echo "sleek: nix-daemon not running — run: bash ${_sleek_root}/scripts/codespace-bootstrap.sh" >&2 echo " or: sudo nix daemon &" >&2 fi unset _sleek_root _sleek_cwd return 0 2>/dev/null || truefi
# Daemon if socket is up; else single-user (must own /nix). Never leave NIX_REMOTE# pointing at a dead multi-user layout — that yields gc.lock Permission denied.if [[ -S /nix/var/nix/daemon-socket/socket ]]; then export NIX_REMOTE=daemonelse unset NIX_REMOTE || true if [[ ! -w /nix/var/nix ]]; then if [[ -z "${SLEEK_NIX_HINT:-}" ]]; then export SLEEK_NIX_HINT=1 echo "sleek: nix store not usable — run: bash ${_sleek_root}/scripts/codespace-bootstrap.sh" >&2 fi unset _sleek_root _sleek_cwd return 0 2>/dev/null || true fifi
export SLEEK_NIX_SHELL=1cd "${_sleek_root}" || trueunset _sleek_cwd# Replace this interactive shell with the flake shell (args: none → user shell).exec nix develop "${_sleek_root}" --command "${SHELL:-bash}"