mirror of
https://github.com/nix-community/disko.git
synced 2026-12-04 06:53:28 +01:00
make-disk-image: add --build-memory
This commit is contained in:
1 parent
da38eb67aa
commit
b6fb19891f
1 file changed
+19
-1
+19
-1
@@ -83,6 +83,10 @@ in
|
|||||||
copies the src to the dst on the finished image
|
copies the src to the dst on the finished image
|
||||||
These end up in the images later and is useful if you want to add some extra stateful files
|
These end up in the images later and is useful if you want to add some extra stateful files
|
||||||
They will have the same permissions but will be owned by root:root
|
They will have the same permissions but will be owned by root:root
|
||||||
|
* --build-memory <amt>
|
||||||
|
specify the ammount of memory that gets allocated to the build vm (in mb)
|
||||||
|
This can be usefull if you want to build images with a more involed NixOS config
|
||||||
|
By default the vm will get 1024M/1GB
|
||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,6 +111,15 @@ in
|
|||||||
cp --reflink=auto -r "$src" copy_after_disko/"$(echo "$dst" | base64)"
|
cp --reflink=auto -r "$src" copy_after_disko/"$(echo "$dst" | base64)"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--build-memory)
|
||||||
|
regex="^[0-9]+$"
|
||||||
|
if ! [[ $2 =~ $regex ]]; then
|
||||||
|
echo "'$2' is not a number"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
build_memory=$2
|
||||||
|
shift 1
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
showUsage
|
showUsage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -141,7 +154,12 @@ in
|
|||||||
done
|
done
|
||||||
${installer}
|
${installer}
|
||||||
''}
|
''}
|
||||||
export QEMU_OPTS=${lib.escapeShellArg "${QEMU_OPTS} -m 1024"}
|
|
||||||
|
build_memory=''${build_memory:-1024}
|
||||||
|
QEMU_OPTS=${lib.escapeShellArg QEMU_OPTS}
|
||||||
|
QEMU_OPTS+=" -m $build_memory"
|
||||||
|
export QEMU_OPTS
|
||||||
|
|
||||||
${pkgs.bash}/bin/sh -e ${pkgs.vmTools.vmRunCommand pkgs.vmTools.qemuCommandLinux}
|
${pkgs.bash}/bin/sh -e ${pkgs.vmTools.vmRunCommand pkgs.vmTools.qemuCommandLinux}
|
||||||
cd /
|
cd /
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in new issue
Block a user