···11+#!/usr/bin/env nu
22+# SPDX-License-Identifier: AGPL-3.0-only
33+# SPDX-FileCopyrightText: MatrixFurry <matrix@matrixfurry.com>
44+55+const axr = path self ..
66+77+# Upload envision-oci package to GitLab for AtomicXR Homebrew
88+def main [
99+ job: int # envision GitLab job ID
1010+ version: int # envision-oci package version
1111+ token?: string # GitLab deploy token
1212+] {
1313+ cd (mktemp -dt)
1414+1515+ let token = $token | default $env.DEPLOY_TOKEN?
1616+ if ($token | is-empty) {
1717+ error make {
1818+ msg: "Either --token or $env.DEPLOY_TOKEN is required"
1919+ }
2020+ }
2121+2222+ mkdir pkg
2323+ cp ($axr | path join "envision/pkg-install.nu") pkg/install.nu
2424+ chmod 744 pkg/install.nu
2525+2626+ mkdir pkg/oci-shim
2727+ cp ($axr | path join "envision/shim.nu") pkg/oci-shim/cmake
2828+ cp ($axr | path join "envision/shim.nu") pkg/oci-shim/cargo
2929+ chmod 744 pkg/oci-shim/*
3030+3131+ http get "https://gitlab.com/gabmus/envision/-/jobs/#{version}/artifacts/raw/Envision-x86_64.AppImage"
3232+ | save -p pkg/Envision-x86_64.AppImage
3333+3434+ tar -C pkg -zcvf envision-oci.tar.gz .
3535+3636+ open --raw $"envision-oci.tar.gz"
3737+ | into binary
3838+ | http put --content-type application/gzip $"https://gitlab.com/api/v4/projects/75293878/packages/generic/envision-oci/($version)/envision-oci--($job).tar.gz" -H {DEPLOY-TOKEN: $token}
3939+}
+15
envision/shim.nu
···11+#!/usr/bin/env nu
22+# SPDX-License-Identifier: AGPL-3.0-only
33+# SPDX-FileCopyrightText: MatrixFurry <matrix@matrixfurry.com>
44+55+# The purpose of this shim is to make Envision build software in a OCI container, with preinstalled build dependencies.
66+# Just rename this script to the desired build tool, then prepend it to Envision's PATH environment variable. It will
77+# run instead of the system build tool.
88+99+def main --wrapped [...args] {
1010+ # Replace working directory with /build in commands
1111+ let args = $args | str replace -a (pwd) /build
1212+1313+ # TODO: Use latest image from AtomicXR container registry
1414+ podman run localhost/xr-multi:latest -v .:/build -- ...$args
1515+}