nullbox: setup auto decrypt
This commit is contained in:
parent
f2bc1b7d0b
commit
cef77e2a56
@ -10,6 +10,8 @@
|
|||||||
imports =
|
imports =
|
||||||
[ # Include the results of the hardware scan.
|
[ # Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
# Encryption
|
||||||
|
./luks.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -54,16 +56,6 @@
|
|||||||
packageSets.gaming.enable = true;
|
packageSets.gaming.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# cryptsetup
|
|
||||||
boot.initrd.luks.devices = {
|
|
||||||
lvmroot = {
|
|
||||||
device="/dev/disk/by-uuid/85b5f22e-0fa5-4f0d-8fba-f800a0b41671";
|
|
||||||
allowDiscards = true;
|
|
||||||
fallbackToPassword = true;
|
|
||||||
preLVM = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# bootloader setup
|
# bootloader setup
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
efi = {
|
efi = {
|
||||||
|
27
hosts/nullbox/luks.nix
Normal file
27
hosts/nullbox/luks.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
let
|
||||||
|
usb = "903D-DF5B";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
# cryptsetup
|
||||||
|
boot.initrd.kernelModules = ["uas" "usbcore" "usb_storage"];
|
||||||
|
boot.initrd.supportedFilesystems = ["vfat"];
|
||||||
|
|
||||||
|
boot.initrd.luks.devices = {
|
||||||
|
lvmroot = {
|
||||||
|
preOpenCommands = ''
|
||||||
|
mkdir -m 0755 /key
|
||||||
|
sleep 1
|
||||||
|
mount -n -t vfat -o ro `findfs UUID=${usb}` /key
|
||||||
|
'';
|
||||||
|
|
||||||
|
device="/dev/disk/by-uuid/85b5f22e-0fa5-4f0d-8fba-f800a0b41671";
|
||||||
|
keyFile = "/key/image.png"; # yes it's literally an image file. bite me
|
||||||
|
allowDiscards = true;
|
||||||
|
fallbackToPassword = true;
|
||||||
|
preLVM = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user