summaryrefslogtreecommitdiff
path: root/modules/usbauth
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-09-17 20:11:38 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2024-09-17 20:11:38 +0200
commitcc6a046692cebfbd785fdaded753e7b94422eba4 (patch)
tree691d695fd32796b74df7b2b979f6a248bf13a453 /modules/usbauth
parent50dee3ac9feb715d69554eb76b493e1246c0c61e (diff)
fix usbauth
Diffstat (limited to 'modules/usbauth')
-rw-r--r--modules/usbauth/default.nix18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/usbauth/default.nix b/modules/usbauth/default.nix
index aca217e..b10e426 100644
--- a/modules/usbauth/default.nix
+++ b/modules/usbauth/default.nix
@@ -12,15 +12,16 @@
options.usbauth = lib.mkOption {
description = "USB Auth";
type = lib.types.submodule {
- options = lib.mkOption {
- device = lib.types.str;
- keyname = lib.types.str;
- uuid = lib.types.str;
+ options = {
+ enable = lib.mkOption { type = lib.types.bool; };
+ device = lib.mkOption { type = lib.types.str; };
+ keyname = lib.mkOption { type = lib.types.str; };
+ uuid = lib.mkOption { type = lib.types.str; };
};
};
};
- config = {
+ config = lib.mkIf config.usbauth.enable {
boot.initrd.postDeviceCommands = pkgs.lib.mkBefore ''
mkdir -m 0755 -p /key
lsblk -o NAME,UUID
@@ -29,8 +30,9 @@
mount -o ro "/dev/mapper/_key" /key
'';
- boot.initrd.luks.devices."${config.usbauth.device
- }".keyFile = "/key/.keys/${config.usbauth.keyname}";
- boot.initrd.luks.devices."${config.usbauth.device}".preLVM = false;
+ boot.initrd.luks.devices."${config.usbauth.device}" = {
+ keyFile = "/key/.keys/${config.usbauth.keyname}";
+ preLVM = false;
+ };
};
}