mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 22:43:28 +01:00
Remove trialing newline in passwordFile
This commit is contained in:
1 parent
3eb703b7bc
commit
bf50636a65
3 files changed
+56
-4
No files matched your search
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
vdb = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/vdb";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
ESP = {
|
||||||
|
size = "100M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
luks = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "luks";
|
||||||
|
name = "crypted";
|
||||||
|
extraOpenArgs = [ "--allow-discards" ];
|
||||||
|
passwordFile = "/tmp/secret.key";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+7
-4
@@ -4,9 +4,12 @@ let
|
|||||||
if lib.hasAttr "keyFile" config.settings
|
if lib.hasAttr "keyFile" config.settings
|
||||||
then config.settings.keyFile
|
then config.settings.keyFile
|
||||||
else if config.passwordFile != null
|
else if config.passwordFile != null
|
||||||
then config.passwordFile
|
then ''<(echo -n "$(cat ${config.passwordFile})")''
|
||||||
else if config.keyFile != null
|
else if config.keyFile != null
|
||||||
then lib.warn "The option `keyFile` is deprecated. Use passwordFile instead" config.keyFile
|
then lib.warn
|
||||||
|
("The option `keyFile` is deprecated."
|
||||||
|
+ "Use passwordFile instead if you want to use interactive login or settings.keyFile if you want to use key file login")
|
||||||
|
config.keyFile
|
||||||
else null;
|
else null;
|
||||||
keyFileArgs = ''\
|
keyFileArgs = ''\
|
||||||
${lib.optionalString (keyFile != null) "--key-file ${keyFile}"} \
|
${lib.optionalString (keyFile != null) "--key-file ${keyFile}"} \
|
||||||
@@ -33,13 +36,13 @@ in
|
|||||||
keyFile = lib.mkOption {
|
keyFile = lib.mkOption {
|
||||||
type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname;
|
type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Path to the key for encryption (Renamed to passwordFile)";
|
description = "DEPRECATED use passwordFile or settings.keyFile. Path to the key for encryption";
|
||||||
example = "/tmp/disk.key";
|
example = "/tmp/disk.key";
|
||||||
};
|
};
|
||||||
passwordFile = lib.mkOption {
|
passwordFile = lib.mkOption {
|
||||||
type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname;
|
type = lib.types.nullOr diskoLib.optionTypes.absolute-pathname;
|
||||||
default = null;
|
default = null;
|
||||||
description = "Path to the file which contains the password for initial encryption. Make sure it doesn't contain a trailing newline";
|
description = "Path to the file which contains the password for initial encryption";
|
||||||
example = "/tmp/disk.key";
|
example = "/tmp/disk.key";
|
||||||
};
|
};
|
||||||
settings = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { }
|
||||||
|
, diskoLib ? pkgs.callPackage ../lib { }
|
||||||
|
}:
|
||||||
|
diskoLib.testLib.makeDiskoTest {
|
||||||
|
inherit pkgs;
|
||||||
|
name = "luks-interactive-login";
|
||||||
|
disko-config = ../example/luks-interactive-login.nix;
|
||||||
|
extraTestScript = ''
|
||||||
|
machine.succeed("cryptsetup isLuks /dev/vda2");
|
||||||
|
'';
|
||||||
|
}
|
||||||
Reference in new issue
Block a user