Send files to virtual machine

Hey, i just build a virtual machine using nixos-rebuild build-vm --flake .#default, i want to move my flake files to the vim so i can test home-manager rebuild. how i do that?

Enable ssh, syncthing, whatever in your vm config, and send files that way. Same as any other case where you want to send files between machines.

EDIT: or in this case since it is code after all, you can of course use a vcs platform like github/gitlab/codeberg… but if it’s just a one-off copy, that might be overkill.

2 Likes

You can also share files with $TMPDIR/xchg, and configure other directories with the VM module: nixpkgs/nixos/modules/virtualisation/qemu-vm.nix at 6c5e3fdb42b323dc5dd2206772985d60925a59ba · NixOS/nixpkgs · GitHub

Sharing stuff the way you otherwise would is a good habit if you want to test how you’re going to use the machine otherwise, though.

3 Likes