make-disk-image: clean up
This commit is contained in:
parent
f7bb8d2dfa
commit
a2d3ee77b8
@ -40,11 +40,11 @@
|
||||
with lib;
|
||||
|
||||
let
|
||||
extensions = {
|
||||
filename = "nixos." + {
|
||||
qcow2 = "qcow2";
|
||||
vpc = "vhd";
|
||||
raw = "img";
|
||||
};
|
||||
}.${format};
|
||||
|
||||
nixpkgs = cleanSource pkgs.path;
|
||||
|
||||
@ -125,7 +125,7 @@ let
|
||||
fakeroot nixos-prepare-root $root ${channelSources} ${config.system.build.toplevel} closure
|
||||
|
||||
echo "copying staging root to image..."
|
||||
cptofs ${pkgs.lib.optionalString partitioned "-P 1"} -t ${fsType} -i $diskImage $root/* /
|
||||
cptofs ${optionalString partitioned "-P 1"} -t ${fsType} -i $diskImage $root/* /
|
||||
'';
|
||||
in pkgs.vmTools.runInLinuxVM (
|
||||
pkgs.runCommand name
|
||||
@ -134,12 +134,11 @@ in pkgs.vmTools.runInLinuxVM (
|
||||
exportReferencesGraph = [ "closure" metaClosure ];
|
||||
postVM = ''
|
||||
${if format == "raw" then ''
|
||||
mv $diskImage $out/nixos.img
|
||||
diskImage=$out/nixos.img
|
||||
mv $diskImage $out/${filename}
|
||||
'' else ''
|
||||
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/nixos.${extensions.${format}}
|
||||
diskImage=$out/nixos.${extensions.${format}}
|
||||
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/${filename}
|
||||
''}
|
||||
diskImage=$out/${filename}
|
||||
${postVM}
|
||||
'';
|
||||
memSize = 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user