Sleek — mobile freeq client (Vidya + freeq-sdk)
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788#!/usr/bin/env bash# Shim: re-exec into the sleek flake shell if we are not already in it.## Usage:# ./scripts/enter # interactive shell# ./scripts/enter just host # one-shot commandset -euo pipefailROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"cd "$ROOT"SOCKET="/nix/var/nix/daemon-socket/socket"# shellcheck disable=SC1091if [[ -f /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh ]]; then . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shelif [[ -f "$HOME/.nix-profile/etc/profile.d/nix.sh" ]]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh"fiexport PATH="/nix/var/nix/profiles/default/bin:${HOME}/.nix-profile/bin:${PATH}"# shellcheck disable=SC1091. "$ROOT/scripts/ensure-nix-flakes.sh"ensure_nix_flakes# Already inside a nix develop / nix-shell for this project?if [[ -n "${IN_NIX_SHELL:-}" || -n "${SLEEK_NIX_SHELL:-}" ]]; then if [[ $# -gt 0 ]]; then exec "$@" fi exec "${SHELL:-bash}" -lfiif ! command -v nix >/dev/null 2>&1; then echo "sleek: nix not found. Run: bash scripts/codespace-bootstrap.sh" >&2 exit 1fi# Prefer daemon when present; otherwise single-user (must own /nix/var/nix).if [[ -S "$SOCKET" ]]; then export NIX_REMOTE=daemonelif [[ -w /nix/var/nix ]]; then unset NIX_REMOTE || trueelse # Try quick daemon start, then single-user chown. if command -v sudo >/dev/null 2>&1 && sudo -n true 2>/dev/null; then echo "sleek: repairing nix access…" >&2 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 &' || true else sudo bash -c 'setsid nix daemon >>/tmp/nix-daemon.log 2>&1 < /dev/null &' || true fi for _ in $(seq 1 20); do [[ -S "$SOCKET" ]] && break sleep 0.25 done if [[ -S "$SOCKET" ]]; then export NIX_REMOTE=daemon else # Full single-user — fixes gc.lock Permission denied on Codespaces. sudo chown -R "$(id -u):$(id -g)" /nix 2>/dev/null || true if [[ -f /etc/nix/nix.conf ]]; then sudo sed -i 's/^build-users-group.*/build-users-group =/' /etc/nix/nix.conf 2>/dev/null || true fi unset NIX_REMOTE || true fi fifiif [[ -S "$SOCKET" ]]; then export NIX_REMOTE=daemonelif [[ ! -w /nix/var/nix ]]; then echo "sleek: cannot use nix store (not daemon, /nix/var/nix not writable)." >&2 echo " Fix: bash scripts/codespace-bootstrap.sh" >&2 echo " Or: sudo chown -R \"\$(id -u):\$(id -g)\" /nix && unset NIX_REMOTE" >&2 echo " Or: sudo nix daemon & && export NIX_REMOTE=daemon" >&2 exit 1else unset NIX_REMOTE || truefiexport SLEEK_NIX_SHELL=1if [[ $# -gt 0 ]]; then exec nix develop "$ROOT" --command "$@"fiexec nix develop "$ROOT" --command "${SHELL:-bash}"