Add fallback to our mesa package for non-NixOS hosts

This commit is contained in:
Val Packett 2025-11-27 21:59:05 -03:00
parent c164db06c1
commit 59137223a9
3 changed files with 12 additions and 2 deletions

View file

@ -70,6 +70,7 @@
};
munix = pkgs.callPackage ./packages/munix {
mesa = self.packages.${system}.mesa;
muvm = self.packages.${system}.muvm;
sidebus-broker = sidebus.packages.${system}.sidebus-broker;
};

9
munix
View file

@ -15,6 +15,10 @@ PIPEWIRE=1
X11=0
export TMP=/tmp TMPDIR=/tmp TEMP=/tmp TEMPDIR=/tmp LC_ALL=C
if [ ! -e "$HOST_OPENGL_DRIVER" ]; then
HOST_OPENGL_DRIVER="$FALLBACK_OPENGL_DRIVER"
fi
while [ "$#" -gt 0 ]; do
case "$1" in
-u|--uid) MICROVM_UID="$2"; shift 2;;
@ -58,6 +62,11 @@ if [ "$PASST_PATH" = "" ]; then
exit 1
fi
if [ ! -e "$HOST_OPENGL_DRIVER" ]; then
echo "munix: host graphics driver not found, provide a --host-opengl-driver" >&2
exit 1
fi
# Resolve symlinks automatically
MICROVM_CLOSURE=$(realpath "$MICROVM_CLOSURE")

View file

@ -1,4 +1,4 @@
{ writeScriptBin, symlinkJoin, makeWrapper, muvm, passt, bubblewrap, sidebus-broker }:
{ writeScriptBin, symlinkJoin, makeWrapper, muvm, passt, bubblewrap, sidebus-broker, mesa }:
let
munixScript = (writeScriptBin "munix" (builtins.readFile ../../munix)).overrideAttrs(old: {
@ -9,6 +9,6 @@ in symlinkJoin {
paths = [ munixScript muvm passt bubblewrap sidebus-broker ];
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/munix --prefix PATH : $out/bin
wrapProgram $out/bin/munix --prefix PATH : $out/bin --set FALLBACK_OPENGL_DRIVER ${mesa}
'';
}