From 3f8b1d2d26364f9f627055387804900f3f1e0624 Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Wed, 27 Dec 2023 22:47:02 -0500 Subject: [PATCH] nixos/lxd-agent: add system path for exec --- nixos/modules/virtualisation/lxd-agent.nix | 8 +++++++- nixos/tests/incus/virtual-machine.nix | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/lxd-agent.nix b/nixos/modules/virtualisation/lxd-agent.nix index 5386cc5c439a..41d08b515648 100644 --- a/nixos/modules/virtualisation/lxd-agent.nix +++ b/nixos/modules/virtualisation/lxd-agent.nix @@ -60,7 +60,13 @@ in { wantedBy = [ "multi-user.target" ]; before = [ "shutdown.target" ]; conflicts = [ "shutdown.target" ]; - path = [ pkgs.kmod pkgs.util-linux ]; + path = [ + pkgs.kmod + pkgs.util-linux + + # allow `incus exec` to find system binaries + "/run/current-system/sw" + ]; preStart = preStartScript; diff --git a/nixos/tests/incus/virtual-machine.nix b/nixos/tests/incus/virtual-machine.nix index be5746ef63e2..343a25ca7297 100644 --- a/nixos/tests/incus/virtual-machine.nix +++ b/nixos/tests/incus/virtual-machine.nix @@ -53,5 +53,8 @@ in with subtest("lxd-agent is started"): machine.succeed("incus exec ${instance-name} systemctl is-active lxd-agent") + + with subtest("lxd-agent has a valid path"): + machine.succeed("incus exec ${instance-name} -- bash -c 'true'") ''; })