63 lines
1.4 KiB
Bash
Raw Normal View History

2026-06-10 21:14:47 -03:00
#!/usr/bin/env bash
set -euo pipefail
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SOURCE_DIR}/common.sh"
LOGOS_BASE="$(cd "${SOURCE_DIR}/.." && pwd)/logos"
export LOGOS_BASE
mkdir -p "${LOGOS_BASE}"
_find_lgx() {
local matches
mapfile -t matches < <(find -L ./ -type f -name "*.lgx")
if (( ${#matches[@]} != 1 )); then
echoerr "Expected exactly 1 LGX file, found ${#matches[@]}"
return 1
fi
realpath "${matches[0]}"
}
lg_build_local_basecamp() {
if [[ -z "${LOGOS_QT_MCP:-}" ]]; then
echoerr "LOGOS_QT_MCP is not set"
return 1
fi
cd "${LOGOS_BASE}/logos-basecamp" || return 1
nix build --override-input logos-qt-mcp "path:${LOGOS_QT_MCP}" '.#app' || return 1
if [ -e ./result/bin/LogosBasecamp ]; then
echo "${PWD}/result/bin/LogosBasecamp"
else
echoerr "No output found"
return 1
fi
}
lg_build_local_lgx() {
local lgx module
module="$1"
cd "${LOGOS_BASE}/${module}" || return 1
nix bundle --bundler github:logos-co/nix-bundle-lgx ".#lib" || return 1
lgx=$(_find_lgx)
echoerr "LGX generated at ${lgx}"
echo "${lgx}"
}
lg_build_storage_ui_lgx() {
local lgx
cd "${LOGOS_BASE}/logos-storage-ui" || return 1
nix build '.#lgx' || return 1
lgx=$(_find_lgx)
echoerr "LGX generated at ${lgx}"
echo "${lgx}"
}
lg_start_basecamp() {
local basecamp
basecamp=$(lg_build_local_basecamp) || return 1
"${basecamp}" &
}