mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 02:09:26 +08:00
modules.services.nixvirt: allow images from anywhere
This commit is contained in:
@@ -21,7 +21,7 @@ inputs:
|
|||||||
storage =
|
storage =
|
||||||
{
|
{
|
||||||
name = mkOption { type = types.nonEmptyStr; default = submoduleInputs.config._module.args.name; };
|
name = mkOption { type = types.nonEmptyStr; default = submoduleInputs.config._module.args.name; };
|
||||||
nodatacow = mkOption { type = types.bool; default = false; };
|
mountFrom = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
||||||
iso = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
iso = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
|
||||||
};
|
};
|
||||||
memory =
|
memory =
|
||||||
@@ -199,8 +199,12 @@ inputs:
|
|||||||
type = "file";
|
type = "file";
|
||||||
device = "disk";
|
device = "disk";
|
||||||
driver = { name = "qemu"; type = "raw"; cache = "writeback"; discard = "unmap"; };
|
driver = { name = "qemu"; type = "raw"; cache = "writeback"; discard = "unmap"; };
|
||||||
source.file = "${if v.storage.nodatacow then "/nix/nodatacow" else ""}/var/lib/libvirt/images/"
|
source.file = builtins.concatStringsSep ""
|
||||||
+ "${v.storage.name}.img";
|
[
|
||||||
|
(if (v.storage.mountFrom != null) then "/nix/${v.storage.mountFrom}" else "")
|
||||||
|
"/var/lib/libvirt/images/"
|
||||||
|
"${v.storage.name}.img"
|
||||||
|
];
|
||||||
target = { dev = "vda"; bus = "virtio"; };
|
target = { dev = "vda"; bus = "virtio"; };
|
||||||
boot.order = 1;
|
boot.order = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user