secrets-store: check if files exist

This commit is contained in:
Michele Guerini Rocco 2020-10-26 02:23:58 +01:00
parent 386efec7dc
commit 4aa14e6b8b
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450

View File

@ -11,6 +11,11 @@ let
options = secretOptions; options = secretOptions;
}); });
# Like types.path but also must exists
validFile = with types; path // {
check = x: path.check x && builtins.pathExists x;
};
# Secret file definition # Secret file definition
secretOptions = secretOptions =
{ user = mkOption { user = mkOption
@ -29,7 +34,7 @@ let
description = "File permission (octal format)"; description = "File permission (octal format)";
}; };
path = mkOption path = mkOption
{ type = types.nullOr types.path; { type = types.nullOr validFile;
default = null; default = null;
apply = toString; apply = toString;
description = "File to include in the secret store"; description = "File to include in the secret store";