1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-11 09:04:01 +03:00

image-builder: minimumSize is a filesystem specific option

This commit is contained in:
Samuel Dionne-Riel 2019-08-28 21:54:12 -04:00
parent 346efd3b15
commit 763a912d3c
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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