32 lines
785 B
Nix
32 lines
785 B
Nix
{ stdenv, bash, parted, cryptsetup, e2fsprogs }:
|
|
let usb_data = import ../hosts/lappy/hardware/usb_data.nix { };
|
|
in stdenv.mkDerivation {
|
|
name = "mk-enc-usb";
|
|
src = ./mk-enc-usb.sh;
|
|
unpackPhase = ''
|
|
for srcFile in $src; do
|
|
cp $srcFile $(stripHash $srcFile)
|
|
done
|
|
'';
|
|
|
|
inherit bash;
|
|
inherit parted;
|
|
inherit cryptsetup;
|
|
inherit e2fsprogs;
|
|
|
|
patchPhase = ''
|
|
substituteAllInPlace mk-enc-usb.sh
|
|
substituteInPlace mk-enc-usb.sh \
|
|
--replace "@TEST@" "nyaaaaa" \
|
|
--replace "@USB_ENCRYPTED_PARTLABEL@" "${usb_data.encrypted_partlabel}" \
|
|
--replace "@USB_UNENCRYPTED_LABEL@" "${usb_data.unencrypted_label}"
|
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cp mk-enc-usb.sh $out/bin/mk-enc-usb
|
|
chmod +x $out/bin/mk-enc-usb
|
|
'';
|
|
}
|