Skip to content

Commit 5f9a75d

Browse files
committed
Allow overriding external binary paths via compile-time env vars
This is particularly useful for Nix, to avoid patching code when building. Signed-off-by: Val Packett <[email protected]>
1 parent 51c3960 commit 5f9a75d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/muvm/src/guest/bin/muvm-guest.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ fn main() -> Result<ExitCode> {
7777
rustix::stdio::dup2_stdout(console.as_fd())?;
7878
rustix::stdio::dup2_stderr(console.as_fd())?;
7979

80-
Command::new("/usr/lib/systemd/systemd-udevd").spawn()?;
80+
Command::new(std::option_env!("MUVM_UDEVD_PATH").unwrap_or("/usr/lib/systemd/systemd-udevd"))
81+
.spawn()
82+
.context("Running systemd-udevd")?;
8183

8284
if let Some(emulator) = options.emulator {
8385
match emulator {

crates/muvm/src/monitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn set_guest_pressure(pressure: GuestPressure) -> Result<()> {
4949
let wsf: u32 = pressure.into();
5050
debug!("setting watermark_scale_factor to {wsf}");
5151

52-
let command = PathBuf::from("/sbin/sysctl");
52+
let command = PathBuf::from(std::option_env!("MUVM_SYSCTL_PATH").unwrap_or("/sbin/sysctl"));
5353
let command_args = vec![format!("vm.watermark_scale_factor={}", wsf)];
5454
let env = HashMap::new();
5555
request_launch(command, command_args, env, 0, false, true)

0 commit comments

Comments
 (0)