Allow hooking local ssh keys into the vm
This commit is contained in:
parent
539d770d20
commit
55e075e01b
|
@ -6,6 +6,11 @@
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sharedHostKeys = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
qemu.runInBackground = lib.mkOption {
|
qemu.runInBackground = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -16,12 +21,27 @@
|
||||||
config = {
|
config = {
|
||||||
virtualisation =
|
virtualisation =
|
||||||
let
|
let
|
||||||
vmConfig = {
|
extendVMConfig =
|
||||||
|
vmVariant: {
|
||||||
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
|
boot.loader.efi.efiSysMountPoint = lib.mkVMOverride "/boot";
|
||||||
};
|
|
||||||
|
virtualisation.sharedDirectories = lib.optionalAttrs (vmVariant.virtualisation.sharedHostKeys) {
|
||||||
|
hostKeys =
|
||||||
|
let
|
||||||
|
path = "/etc/ssh";
|
||||||
in {
|
in {
|
||||||
vmVariant = vmConfig;
|
source = path;
|
||||||
vmVariantWithBootLoader = vmConfig;
|
target = path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation = config.virtualisation;
|
||||||
|
in {
|
||||||
|
|
||||||
|
vmVariant = extendVMConfig virtualisation.vmVariant;
|
||||||
|
vmVariantWithBootLoader = extendVMConfig virtualisation.vmVariantWithBootLoader;
|
||||||
|
runAsRoot = lib.mkIf config.virtualisation.sharedHostKeys true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Replace native `qemu` with `remote-viewer`
|
# Replace native `qemu` with `remote-viewer`
|
||||||
|
|
Loading…
Reference in a new issue