Skip to content

Commit

Permalink
make-disk-image: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
orivej committed Nov 11, 2017
1 parent 462b5e0 commit f218ef6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions nixos/lib/make-disk-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@

, name ? "nixos-disk-image"

, format ? "raw"
, # Disk image format, one of qcow2, vpc, raw.
format ? "raw"
}:

with lib;
Expand All @@ -45,7 +46,7 @@ let
raw = "img";
};

nixpkgs = lib.cleanSource pkgs.path;
nixpkgs = cleanSource pkgs.path;

channelSources = pkgs.runCommand "nixos-${config.system.nixosVersion}" {} ''
mkdir -p $out
Expand Down Expand Up @@ -73,7 +74,7 @@ let
targets = map (x: x.target) contents;

prepareImage = ''
export PATH=${pkgs.lib.makeSearchPathOutput "bin" "bin" prepareImageInputs}
export PATH=${makeSearchPathOutput "bin" "bin" prepareImageInputs}
mkdir $out
diskImage=nixos.raw
Expand All @@ -87,7 +88,7 @@ let
''}
faketime -f "1970-01-01 00:00:01" mkfs.${fsType} -F -L nixos -E offset=$offset $diskImage
root="$PWD/root"
mkdir -p $root
Expand Down Expand Up @@ -132,7 +133,7 @@ let
# shut it up someday but trying to do a stderr filter through grep is running into some nasty
# bug in some eval nonsense we have in runInLinuxVM and I'm sick of trying to fix it.
faketime -f "1970-01-01 00:00:00" \
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
Expand Down

0 comments on commit f218ef6

Please sign in to comment.