2019-08-29 04:54:12 +03:00
|
|
|
{ makeFilesystem, dosfstools, mtools, libfaketime, size }:
|
2019-08-27 21:14:57 +03:00
|
|
|
|
|
|
|
/* */ let scope = { "fileSystem.makeFAT32" =
|
|
|
|
|
|
|
|
{ partitionID, ... } @ args:
|
2019-08-29 03:50:28 +03:00
|
|
|
makeFilesystem (args // {
|
2019-08-27 21:14:57 +03:00
|
|
|
# FAT32 can be used for ESP. Let's make this obvious.
|
|
|
|
filesystemType = if args ? filesystemType then args.filesystemType else "FAT32";
|
|
|
|
|
2019-08-29 04:54:12 +03:00
|
|
|
minimumSize = size.KiB 500;
|
|
|
|
|
2019-08-27 21:14:57 +03:00
|
|
|
nativeBuildInputs = [
|
|
|
|
libfaketime
|
|
|
|
dosfstools
|
|
|
|
mtools
|
|
|
|
];
|
|
|
|
|
|
|
|
filesystemPhase = ''
|
|
|
|
faketime "1970-01-01 00:00:00" mkfs.vfat \
|
2019-08-29 04:46:35 +03:00
|
|
|
-F 32 \
|
2019-08-27 21:14:57 +03:00
|
|
|
-i $partitionID \
|
|
|
|
-n $partName \
|
|
|
|
"$img"
|
|
|
|
'';
|
|
|
|
|
|
|
|
copyPhase = ''
|
2019-08-29 04:31:45 +03:00
|
|
|
for f in ./* ./.*; do
|
|
|
|
if [[ "$f" != "./." && "$f" != "./.." ]]; then
|
2019-08-29 04:47:40 +03:00
|
|
|
faketime "1970-01-01 00:00:00" \
|
|
|
|
mcopy -psv -i "$img" "$f" ::
|
2019-08-29 04:31:45 +03:00
|
|
|
fi
|
|
|
|
done
|
2019-08-27 21:14:57 +03:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
# Always verify FS
|
|
|
|
fsck.vfat -vn "$img"
|
|
|
|
'';
|
|
|
|
})
|
|
|
|
|
|
|
|
/* */ ;}; in scope."fileSystem.makeFAT32"
|