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

View file

@ -6,6 +6,7 @@
...
}: let
user = config.user;
decrypt = import ../lib/decrypt.nix;
in {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
@ -22,19 +23,10 @@ in {
options = ["subvol=@" "compress=zstd" "autodefrag"];
};
boot.initrd.postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -m 0755 -p /key
until cryptsetup luksOpen /dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0 usbkey
do
echo "Failed to unlock usbkey!"
echo "Found block devices:"
ls /dev/disk/by-id/
sleep 2
done
mount -n -t vfat -o ro /dev/mapper/usbkey /key
'';
boot.initrd.postDeviceCommands = pkgs.lib.mkBefore (decrypt {
keydevice = "/dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0";
keypartname = "usbkey";
});
boot.initrd.luks.devices."cryptroot" = {
device = "/dev/disk/by-uuid/570cc51f-bd5c-4bee-a18f-f6aabaf60881";