bunch of helpers to quickly add root SSH access to dev VMs, so you don't need
to hardcode your own SSH key or use --impure.
emphasis on dev: this will generate ephemeral, passphrase-less SSH keys and setup root access to the VM. dont use it for anything else.
let
nixosVmConfig = self.nixosConfigurations.vm.config;
in
{
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
nix-dev-vm-ssh.nixosModules.default
{
# VM config
}
];
};
apps.${system} = {
vm = {
type = "app";
meta.description = "Boot the test VM";
program = pkgs.lib.getExe (
nix-dev-vm-ssh.lib.mkVmExe {
inherit
pkgs
nixosVmConfig
;
text = ''
exec ${nixosVmConfig.system.build.vm}/bin/run-${nixosVmConfig.networking.hostName}-vm "$@"
'';
}
);
};
ssh-vm = nix-dev-vm-ssh.lib.mkSshVmApp { inherit pkgs nixosVmConfig; };
};
}