muvm: 0.4.1 -> 0.5.0 (#472855)

This commit is contained in:
dram
2025-12-23 04:48:28 +00:00
committed by GitHub
+25 -26
View File
@@ -9,15 +9,11 @@
systemd,
udev,
pkg-config,
procps,
fex,
writeShellApplication,
coreutils,
makeBinaryWrapper,
# TODO: Enable again when sommelier is not broken.
# For now, don't give false impression of sommelier being supported.
# sommelier,
# withSommelier ? false,
nix-update-script,
}:
let
# TODO: Setup setuid wrappers.
@@ -28,47 +24,46 @@ let
coreutils
];
text = ''
if [[ ! -f /etc/NIXOS ]]; then exit; fi
ln -s /run/muvm-host/run/current-system /run/current-system
# Only create the symlink if that path exists on the host and is a directory.
if [[ -d /run/muvm-host/run/opengl-driver ]]; then ln -s /run/muvm-host/run/opengl-driver /run/opengl-driver; fi
if [[ -f /etc/NIXOS ]]; then
ln -s /run/muvm-host/run/current-system /run/current-system
if [[ -d /run/muvm-host/run/opengl-driver ]]; then
ln -s /run/muvm-host/run/opengl-driver /run/opengl-driver
fi
fi
'';
};
binPath = [
dhcpcd
passt
(placeholder "out")
]
++ lib.optionals stdenv.hostPlatform.isAarch64 [ fex ];
wrapArgs = lib.escapeShellArgs [
"--prefix"
"PATH"
":"
(lib.makeBinPath binPath)
(lib.makeBinPath (
[
dhcpcd
passt
(placeholder "out")
]
++ lib.optionals stdenv.hostPlatform.isAarch64 [ fex ]
))
"--add-flags"
"--execute-pre=${lib.getExe initScript}"
];
in
rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
pname = "muvm";
version = "0.4.1";
version = "0.5.0";
src = fetchFromGitHub {
owner = "AsahiLinux";
repo = "muvm";
rev = "muvm-${version}";
hash = "sha256-1XPhVEj7iqTxdWyYwNk6cbb9VRGuhpvvowYDPJb1cWU=";
tag = "muvm-${finalAttrs.version}";
hash = "sha256-k3Jj/Tzu5ZfnADMiVG7pAPqosrkZvhmehi0NMbyudN0=";
};
cargoHash = "sha256-fkvdS0c1Ib8Kto44ou06leXy731cpMHXevyFR5RROt4=";
cargoHash = "sha256-jFNyQD2Hf1K5+wHDRD2WG70IJfZbL+hT/gtjeUnt5Mk=";
postPatch = ''
substituteInPlace crates/muvm/src/guest/bin/muvm-guest.rs \
--replace-fail "/usr/lib/systemd/systemd-udevd" "${systemd}/lib/systemd/systemd-udevd"
substituteInPlace crates/muvm/src/monitor.rs \
--replace-fail "/sbin/sysctl" "${lib.getExe' procps "sysctl"}"
''
# Only patch FEX path if we're aarch64, otherwise we don't want the derivation to pull in FEX in any way
+ lib.optionalString stdenv.hostPlatform.isAarch64 ''
@@ -95,6 +90,10 @@ rustPlatform.buildRustPackage rec {
wrapProgram $out/bin/muvm ${wrapArgs}
'';
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Run programs from your system in a microVM";
homepage = "https://github.com/AsahiLinux/muvm";
@@ -106,4 +105,4 @@ rustPlatform.buildRustPackage rec {
inherit (libkrun.meta) platforms;
mainProgram = "muvm";
};
}
})