decryption function

This commit is contained in:
tristan 2024-01-08 21:53:43 +00:00
parent cd5a381451
commit f3eb45a361
7 changed files with 38 additions and 43 deletions

15
lib/decrypt.nix Normal file
View file

@ -0,0 +1,15 @@
{
keydevice,
keypartname,
}: ''
mkdir -m 0755 -p /key
dev=${keydevice}
sleep 1
until cryptsetup luksOpen "$dev" usbkey
do
echo "Insert key and press enter..."
read res
done
mount -n -t vfat -o ro /dev/mapper/${keypartname} /key
''