32 lines
867 B
Nix
32 lines
867 B
Nix
|
{ stdenv, bash, parted, cryptsetup, e2fsprogs, dosfstools }:
|
||
|
let ssd_data = import ../hosts/lappy/hardware/ssd_data.nix { };
|
||
|
in stdenv.mkDerivation {
|
||
|
name = "mk-lappy-ssd";
|
||
|
src = ./mk-lappy-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-lappy-ssd.sh
|
||
|
substituteInPlace mk-lappy-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-lappy-ssd.sh $out/bin/mk-lappy-ssd
|
||
|
chmod +x $out/bin/mk-lappy-ssd
|
||
|
'';
|
||
|
}
|