mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
make-disk-image: clean up
This commit is contained in:
parent
f7bb8d2dfa
commit
a2d3ee77b8
1 changed files with 6 additions and 7 deletions
|
@ -40,11 +40,11 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
extensions = {
|
filename = "nixos." + {
|
||||||
qcow2 = "qcow2";
|
qcow2 = "qcow2";
|
||||||
vpc = "vhd";
|
vpc = "vhd";
|
||||||
raw = "img";
|
raw = "img";
|
||||||
};
|
}.${format};
|
||||||
|
|
||||||
nixpkgs = cleanSource pkgs.path;
|
nixpkgs = cleanSource pkgs.path;
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ let
|
||||||
fakeroot nixos-prepare-root $root ${channelSources} ${config.system.build.toplevel} closure
|
fakeroot nixos-prepare-root $root ${channelSources} ${config.system.build.toplevel} closure
|
||||||
|
|
||||||
echo "copying staging root to image..."
|
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 (
|
in pkgs.vmTools.runInLinuxVM (
|
||||||
pkgs.runCommand name
|
pkgs.runCommand name
|
||||||
|
@ -134,12 +134,11 @@ in pkgs.vmTools.runInLinuxVM (
|
||||||
exportReferencesGraph = [ "closure" metaClosure ];
|
exportReferencesGraph = [ "closure" metaClosure ];
|
||||||
postVM = ''
|
postVM = ''
|
||||||
${if format == "raw" then ''
|
${if format == "raw" then ''
|
||||||
mv $diskImage $out/nixos.img
|
mv $diskImage $out/${filename}
|
||||||
diskImage=$out/nixos.img
|
|
||||||
'' else ''
|
'' else ''
|
||||||
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/nixos.${extensions.${format}}
|
${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} $diskImage $out/${filename}
|
||||||
diskImage=$out/nixos.${extensions.${format}}
|
|
||||||
''}
|
''}
|
||||||
|
diskImage=$out/${filename}
|
||||||
${postVM}
|
${postVM}
|
||||||
'';
|
'';
|
||||||
memSize = 1024;
|
memSize = 1024;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue