2022-12-04 13:45:43 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
bash,
|
|
|
|
parted,
|
|
|
|
cryptsetup,
|
|
|
|
e2fsprogs,
|
|
|
|
}: let
|
2023-07-09 20:07:31 +01:00
|
|
|
usb_data = import ../data/usb_data.nix {};
|
2022-12-04 13:45:43 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "mk-enc-usb";
|
|
|
|
src = ./mk-enc-usb.sh;
|
|
|
|
unpackPhase = ''
|
|
|
|
for srcFile in $src; do
|
|
|
|
cp $srcFile $(stripHash $srcFile)
|
|
|
|
done
|
|
|
|
'';
|
2022-02-16 16:07:57 +00:00
|
|
|
|
2022-12-04 13:45:43 +00:00
|
|
|
inherit bash parted cryptsetup e2fsprogs;
|
2022-02-16 16:07:57 +00:00
|
|
|
|
2022-12-04 13:45:43 +00:00
|
|
|
patchPhase = ''
|
|
|
|
substituteAllInPlace mk-enc-usb.sh
|
|
|
|
substituteInPlace mk-enc-usb.sh \
|
|
|
|
--replace "@USB_ENCRYPTED_PARTLABEL@" "${usb_data.encrypted_partlabel}" \
|
|
|
|
--replace "@USB_UNENCRYPTED_LABEL@" "${usb_data.unencrypted_label}"
|
|
|
|
'';
|
2022-02-16 16:07:57 +00:00
|
|
|
|
2022-12-04 13:45:43 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp mk-enc-usb.sh $out/bin/mk-enc-usb
|
|
|
|
chmod +x $out/bin/mk-enc-usb
|
|
|
|
'';
|
|
|
|
}
|