decryption function
This commit is contained in:
parent
cd5a381451
commit
f3eb45a361
7 changed files with 38 additions and 43 deletions
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
...
|
||||
}: let
|
||||
user = config.user;
|
||||
decrypt = import ../lib/decrypt.nix;
|
||||
in {
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
|
|
@ -24,22 +25,10 @@ in {
|
|||
options = ["subvol=@" "compress=zstd" "autodefrag"];
|
||||
};
|
||||
|
||||
boot.initrd.postDeviceCommands = pkgs.lib.mkBefore ''
|
||||
mkdir -m 0755 -p /key
|
||||
|
||||
dev=/dev/disk/by-id/usb-Generic_Flash_Disk_BCC97785-0:0
|
||||
sleep 1
|
||||
until cryptsetup luksOpen "$dev" usbkey
|
||||
do
|
||||
echo "Insert key and press enter..."
|
||||
read res
|
||||
if test "$res" = "fzf"
|
||||
then
|
||||
ls /dev/disk/by-id | ${pkgs.fzf}/bin/fzf
|
||||
fi
|
||||
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/cc0617df-8cbf-4618-abbc-df64c96de151";
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@
|
|||
...
|
||||
}: let
|
||||
modifier = config.windowManager.modifierKey;
|
||||
|
||||
in {
|
||||
imports = [
|
||||
(import ./swaylock.nix)
|
||||
(import ./swayidle.nix)
|
||||
(import ./waybar.nix)
|
||||
(import ./hycov.nix)
|
||||
# (import ./hycov.nix)
|
||||
];
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
|
|
|
|||
15
lib/decrypt.nix
Normal file
15
lib/decrypt.nix
Normal 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
|
||||
''
|
||||
|
|
@ -62,7 +62,8 @@ with lib; let
|
|||
name = display.name;
|
||||
value = let
|
||||
res = display.resolution;
|
||||
in {
|
||||
in
|
||||
{
|
||||
mode =
|
||||
mkIf (!resUnset res)
|
||||
"${toString res.x}x${toString res.y}@${toString res.freq}Hz";
|
||||
|
|
@ -70,8 +71,7 @@ with lib; let
|
|||
}
|
||||
// lib.mkIf (display ? wallpaper && display.wallpaper != null) {
|
||||
bg = "${display.wallpaper} fill";
|
||||
}
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
resolutionType = types.submodule {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue