summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLassulus <github@lassul.us>2022-08-24 17:18:42 +0200
committerGitHub <noreply@github.com>2022-08-24 17:18:42 +0200
commit7328d8b41ed25b515a7f66678b1bec84d071264e (patch)
tree39efacffa6fbf4570843d9d1d5b75b15091b34ea
parent9bca66ca7d2f8c9ac39d1f4a067ae45e681b87f9 (diff)
parente1927693e33eabf1bdd29155bb843efb09d47af1 (diff)
Merge pull request #21 from Baitinq/master
-rw-r--r--lib/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/default.nix b/lib/default.nix
index f2908f5..3d86f28 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -76,8 +76,8 @@ let {
'';
create.luks = q: x: ''
- cryptsetup -q luksFormat ${q.device} ${x.keyfile} ${toString (x.extraArgs or [])}
- cryptsetup luksOpen ${q.device} ${x.name} --key-file ${x.keyfile}
+ cryptsetup -q luksFormat ${q.device} ${if builtins.hasAttr "keyfile" x then x.keyfile else ""} ${toString (x.extraArgs or [])}
+ cryptsetup luksOpen ${q.device} ${x.name} ${if builtins.hasAttr "keyfile" x then "--key-file " + x.keyfile else ""}
${create-f { device = "/dev/mapper/${x.name}"; } x.content}
'';
@@ -141,7 +141,7 @@ let {
recursiveUpdate
(mount-f { device = "/dev/mapper/${x.name}"; } x.content)
{luks.${q.device} = ''
- cryptsetup luksOpen ${q.device} ${x.name} --key-file ${x.keyfile}
+ cryptsetup luksOpen ${q.device} ${x.name} ${if builtins.hasAttr "keyfile" x then "--key-file " + x.keyfile else ""}
'';}
);