mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
types disk: add imageSize for makeDiskImage
This commit is contained in:
parent
a8834f94f3
commit
578ad4ef34
2 changed files with 9 additions and 1 deletions
|
@ -22,7 +22,7 @@ pkgs.vmTools.runInLinuxVM (pkgs.runCommand name {
|
|||
];
|
||||
preVM = ''
|
||||
# TODO: get size either dynamically or from disko config
|
||||
${lib.concatMapStringsSep "\n" (disk: "truncate -s 15G ${disk.name}.raw") (lib.attrValues nixosConfig.config.disko.devices.disk)}
|
||||
${lib.concatMapStringsSep "\n" (disk: "truncate -s ${disk.imageSize} ${disk.name}.raw") (lib.attrValues nixosConfig.config.disko.devices.disk)}
|
||||
'';
|
||||
postVM = ''
|
||||
mkdir -p $out
|
||||
|
|
|
@ -16,6 +16,14 @@
|
|||
type = diskoLib.optionTypes.absolute-pathname; # TODO check if subpath of /dev ? - No! eg: /.swapfile
|
||||
description = "Device path";
|
||||
};
|
||||
imageSize = lib.mkOption {
|
||||
type = lib.types.strMatching "[0-9]+[KMGTP]?";
|
||||
description = ''
|
||||
size of the image if the makeDiskImage function from diksoLib is used.
|
||||
is used as an argument to truncate -s
|
||||
'';
|
||||
default = "15G";
|
||||
};
|
||||
content = diskoLib.deviceType { parent = config; device = config.device; };
|
||||
_meta = lib.mkOption {
|
||||
internal = true;
|
||||
|
|
Loading…
Reference in a new issue