From 763a912d3c51d7257ba666931adf7f5807e20b95 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Wed, 28 Aug 2019 21:54:12 -0400 Subject: [PATCH] image-builder: minimumSize is a filesystem specific option --- lib/image-builder/makeFAT32.nix | 4 +++- lib/image-builder/makeFilesystem.nix | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/image-builder/makeFAT32.nix b/lib/image-builder/makeFAT32.nix index 4687cd46..4081ca3c 100644 --- a/lib/image-builder/makeFAT32.nix +++ b/lib/image-builder/makeFAT32.nix @@ -1,4 +1,4 @@ -{ makeFilesystem, dosfstools, mtools, libfaketime }: +{ makeFilesystem, dosfstools, mtools, libfaketime, size }: /* */ let scope = { "fileSystem.makeFAT32" = @@ -7,6 +7,8 @@ makeFilesystem (args // { # FAT32 can be used for ESP. Let's make this obvious. filesystemType = if args ? filesystemType then args.filesystemType else "FAT32"; + minimumSize = size.KiB 500; + nativeBuildInputs = [ libfaketime dosfstools diff --git a/lib/image-builder/makeFilesystem.nix b/lib/image-builder/makeFilesystem.nix index c781f0fc..5f296286 100644 --- a/lib/image-builder/makeFilesystem.nix +++ b/lib/image-builder/makeFilesystem.nix @@ -1,10 +1,9 @@ -{ stdenvNoCC, lib, writeText, size }: +{ stdenvNoCC, lib, writeText }: /* */ let scope = { "fileSystem.makeFilesystem" = let inherit (lib) optionals optionalString assertMsg; - minimumSize = toString (size.KiB 500); in { @@ -58,9 +57,9 @@ stdenvNoCC.mkDerivation (args // rec { size=$(cd files; du -sb --apparent-size . | tr -cd '[:digit:]') ''} - if (( size < ${minimumSize} )); then - size=${minimumSize} - echo "WARNING: partition was too small, size increased to ${minimumSize} bytes." + if (( size < minimumSize )); then + size=$minimumSize + echo "WARNING: partition was too small, size increased to $minimumSize bytes." fi echo