···11-#!/usr/bin/env nu
22-# SPDX-License-Identifier: AGPL-3.0-only
33-# Copyright (c) 2026 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-use std log
1010-1111-const cmd = path self | path basename
1212-const image = "registry.gitlab.com/matrixfurry/xr-packages/xr-multi:latest"
1313-1414-def main --wrapped [...args] {
1515- let args = $args | where ($it | is-not-empty)
1616-1717- # HACK: I don't exactly know why the source path gets appended to the command line
1818- let last_as_workdir = $cmd == "cmake" and $args.0 == "-B"
1919- let workdir = if $last_as_workdir {
2020- $args | last
2121- } else {
2222- pwd
2323- }
2424- let args = if $last_as_workdir {
2525- $args | drop 1
2626- } else {
2727- $args
2828- }
2929-3030- log info $"Working directory: ($workdir)"
3131- log info $"Running in OCI container via shim: ($cmd) ($args | str join ' ')"
3232-3333- # TODO: Use image from AtomicXR container registry
3434- podman run ...[
3535- --security-opt label=disable
3636- --security-opt apparmor=unconfined
3737- -v $"($env.HOME):($env.HOME)"
3838- --workdir $workdir
3939- --env=PWD=$workdir
4040- --rm
4141- ] $image $cmd ...$args
4242-}
+41
shim/build.nu
···11+#!/usr/bin/env nu
22+# SPDX-License-Identifier: AGPL-3.0-only
33+# Copyright (c) 2026 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+use std log
1010+1111+const cmd = path self | path basename
1212+const image = "registry.gitlab.com/matrixfurry/xr-packages/xr-multi:latest"
1313+1414+def main --wrapped [...args] {
1515+ let args = $args | where ($it | is-not-empty)
1616+1717+ # HACK: I don't exactly know why the source path gets appended to the command line
1818+ let last_as_workdir = $cmd == "cmake" and $args.0 == "-B"
1919+ let workdir = if $last_as_workdir {
2020+ $args | last
2121+ } else {
2222+ pwd
2323+ }
2424+ let args = if $last_as_workdir {
2525+ $args | drop 1
2626+ } else {
2727+ $args
2828+ }
2929+3030+ log info $"Working directory: ($workdir)"
3131+ log info $"Running in OCI container via shim: ($cmd) ($args | str join ' ')"
3232+3333+ podman run ...[
3434+ --security-opt label=disable
3535+ --security-opt apparmor=unconfined
3636+ -v $"($env.HOME):($env.HOME)"
3737+ --workdir $workdir
3838+ --env=PWD=$workdir
3939+ --rm
4040+ ] $image $cmd ...$args
4141+}