Skip to content

Instantly share code, notes, and snippets.

@arianvp
Created August 6, 2020 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arianvp/2ef35b994b1dd6bbe3a20a501059e863 to your computer and use it in GitHub Desktop.
Save arianvp/2ef35b994b1dd6bbe3a20a501059e863 to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {}}:
let inherit (pkgs) stdenv utillnux;
in
stdenv.mkDerivation {
name = "efi";
nativeBuildInputs = [
utillinux
];
buildCommand = ''
reserved=4096
espSize=14944
rootSize=71176
veritySize=576
fullSize=$(($reserved + $espSize + $rootSize + $veritySize))
echo $fullSize
truncate --size $(( $fullSize * 512 )) out.img
sfdisk out.img <<EOF
label: gpt
size=$espSize
size=$rootSize
size=$veritySize
EOF
cp out.img $out
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment