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
Samuel Dionne-Riel 9b38d6bbf6 image-builder: makeFAT32: make FAT32 image more reproducible
The current code in <nixpkgs> is reproducible since the date/time comes
from the store. With my particular tests, the date/time is the current
one since I'm using `>` to create test files.
2019-08-28 21:47:40 -04:00

40 lines
837 B
Nix

{ makeFilesystem, dosfstools, mtools, libfaketime }:
/* */ let scope = { "fileSystem.makeFAT32" =
{ partitionID, ... } @ args:
makeFilesystem (args // {
# FAT32 can be used for ESP. Let's make this obvious.
filesystemType = if args ? filesystemType then args.filesystemType else "FAT32";
nativeBuildInputs = [
libfaketime
dosfstools
mtools
];
filesystemPhase = ''
faketime "1970-01-01 00:00:00" mkfs.vfat \
-F 32 \
-i $partitionID \
-n $partName \
"$img"
'';
copyPhase = ''
for f in ./* ./.*; do
if [[ "$f" != "./." && "$f" != "./.." ]]; then
faketime "1970-01-01 00:00:00" \
mcopy -psv -i "$img" "$f" ::
fi
done
'';
checkPhase = ''
# Always verify FS
fsck.vfat -vn "$img"
'';
})
/* */ ;}; in scope."fileSystem.makeFAT32"