vars: add .exists to files

This commit is contained in:
lassulus
2025-08-20 15:23:29 +02:00
parent 8904cf27a4
commit 8cdce6c0c8
2 changed files with 11 additions and 1 deletions

View File

@@ -304,6 +304,15 @@ in
description = "The unix file mode of the file. Must be a 4-digit octal number.";
default = "0400";
};
exists = mkOption {
description = ''
Returns true if the file exists, This is used to guard against reading not set value in evaluation.
This currently only works for non secret files.
'';
type = bool;
default = if file.config.secret then throw "Cannot determine existance of secret file" else false;
defaultText = "Throws error because the existance of a secret file cannot be determined";
};
value =
mkOption {
description = ''