aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/autounlock.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/autounlock.nix')
-rw-r--r--nixos/modules/autounlock.nix30
1 files changed, 14 insertions, 16 deletions
diff --git a/nixos/modules/autounlock.nix b/nixos/modules/autounlock.nix
index 0458c7b..7f7c24e 100644
--- a/nixos/modules/autounlock.nix
+++ b/nixos/modules/autounlock.nix
@@ -1,13 +1,12 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-
+{
+ config,
+ lib,
+ pkgs,
+ ...
+}:
+with lib; let
cnf = config.cynerd.autounlock;
-
in {
-
options = {
cynerd.autounlock = mkOption {
type = with types; attrsOf string;
@@ -17,24 +16,23 @@ in {
};
config = mkIf (cnf != {}) {
-
- environment.systemPackages = [ pkgs.luks-hw-password ];
+ environment.systemPackages = [pkgs.luks-hw-password];
boot.initrd = {
extraFiles."/luks-hw-password".source = pkgs.luks-hw-password;
- luks.devices = mapAttrs (name: value: {
+ luks.devices =
+ mapAttrs (name: value: {
device = value;
keyFile = "/keys/${name}.key";
fallbackToPassword = true;
preOpenCommands = ''
mkdir -p /keys
/luks-hw-password/bin/luks-hw-password > /keys/${name}.key
- '';
+ '';
postOpenCommands = ''
rm -rf /keys
- '';
- }) cnf;
+ '';
+ })
+ cnf;
};
-
};
-
}