sd-image: Fix cross compiling

This commit is contained in:
Will Fancher 2018-06-05 03:19:08 -04:00 committed by Tuomas Tynkkynen
parent 47d2f92a05
commit f0957b9477

View File

@ -12,13 +12,12 @@
with lib; with lib;
let let
rootfsImage = import ../../../lib/make-ext4-fs.nix { rootfsImage = pkgs.callPackage ../../../lib/make-ext4-fs.nix ({
inherit pkgs;
inherit (config.sdImage) storePaths; inherit (config.sdImage) storePaths;
volumeLabel = "NIXOS_SD"; volumeLabel = "NIXOS_SD";
} // optionalAttrs (config.sdImage.rootPartitionUUID != null) { } // optionalAttrs (config.sdImage.rootPartitionUUID != null) {
uuid = config.sdImage.rootPartitionUUID; uuid = config.sdImage.rootPartitionUUID;
}; });
in in
{ {
options.sdImage = { options.sdImage = {
@ -94,10 +93,10 @@ in
sdImage.storePaths = [ config.system.build.toplevel ]; sdImage.storePaths = [ config.system.build.toplevel ];
system.build.sdImage = pkgs.stdenv.mkDerivation { system.build.sdImage = pkgs.callPackage ({ stdenv, dosfstools, e2fsprogs, mtools, libfaketime, utillinux }: stdenv.mkDerivation {
name = config.sdImage.imageName; name = config.sdImage.imageName;
buildInputs = with pkgs; [ dosfstools e2fsprogs mtools libfaketime utillinux ]; nativeBuildInputs = [ dosfstools e2fsprogs mtools libfaketime utillinux ];
buildCommand = '' buildCommand = ''
mkdir -p $out/nix-support $out/sd-image mkdir -p $out/nix-support $out/sd-image
@ -138,7 +137,7 @@ in
(cd boot; mcopy -bpsvm -i ../bootpart.img ./* ::) (cd boot; mcopy -bpsvm -i ../bootpart.img ./* ::)
dd conv=notrunc if=bootpart.img of=$img seek=$START count=$SECTORS dd conv=notrunc if=bootpart.img of=$img seek=$START count=$SECTORS
''; '';
}; }) {};
boot.postBootCommands = '' boot.postBootCommands = ''
# On the first boot do some maintenance tasks # On the first boot do some maintenance tasks