36 lines
893 B
Nix
36 lines
893 B
Nix
|
{
|
||
|
stdenv,
|
||
|
bash,
|
||
|
parted,
|
||
|
cryptsetup,
|
||
|
e2fsprogs,
|
||
|
dosfstools,
|
||
|
}: let
|
||
|
ssd_data = import ../data/dual_drive_data.nix {};
|
||
|
in
|
||
|
stdenv.mkDerivation {
|
||
|
name = "mk-dual-enc-ssd";
|
||
|
src = ./mk-dual-enc-ssd.sh;
|
||
|
unpackPhase = ''
|
||
|
for srcFile in $src; do
|
||
|
cp $srcFile $(stripHash $srcFile)
|
||
|
done
|
||
|
'';
|
||
|
|
||
|
inherit bash parted cryptsetup e2fsprogs dosfstools;
|
||
|
|
||
|
patchPhase = ''
|
||
|
substituteAllInPlace mk-dual-enc-ssd.sh
|
||
|
substituteInPlace mk-dual-enc-ssd.sh \
|
||
|
--replace "@SSD_ENCRYPTED_PARTLABEL@" "${ssd_data.encrypted_root_partlabel}" \
|
||
|
--replace "@SSD_UNENCRYPTED_LABEL@" "${ssd_data.unencrypted_root_label}" \
|
||
|
--replace "@SSD_BOOT_LABEL@" "${ssd_data.boot_label}"
|
||
|
'';
|
||
|
|
||
|
installPhase = ''
|
||
|
mkdir -p $out/bin
|
||
|
cp mk-dual-enc-ssd.sh $out/bin/mk-dual-enc-ssd
|
||
|
chmod +x $out/bin/mk-dual-enc-ssd
|
||
|
'';
|
||
|
}
|