32 lines
907 B
Nix
32 lines
907 B
Nix
{ stdenv, bash, parted, cryptsetup, e2fsprogs, dosfstools }:
|
|
let ssd_data = import ../hosts/normal-enc/hardware/ssd_data.nix { };
|
|
in stdenv.mkDerivation {
|
|
name = "mk-normal-enc-ssd";
|
|
src = ./mk-normal-enc-ssd.sh;
|
|
unpackPhase = ''
|
|
for srcFile in $src; do
|
|
cp $srcFile $(stripHash $srcFile)
|
|
done
|
|
'';
|
|
|
|
inherit bash;
|
|
inherit parted;
|
|
inherit cryptsetup;
|
|
inherit e2fsprogs;
|
|
inherit dosfstools;
|
|
|
|
patchPhase = ''
|
|
substituteAllInPlace mk-normal-enc-ssd.sh
|
|
substituteInPlace mk-normal-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-normal-enc-ssd.sh $out/bin/mk-normal-enc-ssd
|
|
chmod +x $out/bin/mk-normal-enc-ssd
|
|
'';
|
|
}
|