1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-17 13:10:29 +03:00
mobile-nixos/lib/image-builder/makeFAT32.nix

42 lines
874 B
Nix
Raw Normal View History

{ makeFilesystem, dosfstools, mtools, libfaketime, size }:
2019-08-27 21:14:57 +03:00
/* */ let scope = { "fileSystem.makeFAT32" =
{ partitionID, ... } @ args:
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";
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 \
-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
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"