Skip to content

Commit

Permalink
Shared /nix/store and read-write tmpfs overlay
Browse files Browse the repository at this point in the history
/nix/store is shared read-only from the host, and in debug mode, there
is read-write tmpfs overlay on top of it, which allows usage of
`nix-shell -p ...` inside the virtual machine.

Signed-off-by: Mika Tammi <[email protected]>
  • Loading branch information
Mika Tammi authored and brianmcgillion committed Sep 28, 2023
1 parent 7fd351b commit dee7313
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
11 changes: 10 additions & 1 deletion modules/virtualization/microvm/appvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,16 @@
mem = vm.ramMb;
vcpu = vm.cores;
hypervisor = "qemu";
storeDiskType = "squashfs";

shares = [
{
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
writableStoreOverlay = lib.mkIf config.ghaf.development.debug.tools.enable "/nix/.rw-store";

interfaces = [
{
type = "tap";
Expand Down
11 changes: 10 additions & 1 deletion modules/virtualization/microvm/guivm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@
microvm = {
mem = 2048;
hypervisor = "qemu";
storeDiskType = "squashfs";

shares = [
{
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
writableStoreOverlay = lib.mkIf config.ghaf.development.debug.tools.enable "/nix/.rw-store";

interfaces = [
{
type = "tap";
Expand Down
11 changes: 10 additions & 1 deletion modules/virtualization/microvm/netvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,16 @@
};
};

microvm.storeDiskType = "squashfs";
microvm = {
shares = [
{
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
writableStoreOverlay = lib.mkIf config.ghaf.development.debug.tools.enable "/nix/.rw-store";
};

imports = import ../../module-list.nix;
})
Expand Down

0 comments on commit dee7313

Please sign in to comment.