change facts path to be the full path

This commit is contained in:
Jörg Thalheim 2024-03-13 14:39:21 +01:00
parent 188a633dc6
commit 8e69d07411

View File

@ -147,14 +147,14 @@
description = ''
path to a fact which is generated by the generator
'';
default = "machines/${config.clanCore.machineName}/facts/${fact.config._module.args.name}";
default = "${config.clanCore.clanDir}/machines/${config.clanCore.machineName}/facts/${fact.config._module.args.name}";
};
value = lib.mkOption {
defaultText = lib.literalExpression "\${config.clanCore.clanDir}/\${fact.config.path}";
type = lib.types.nullOr lib.types.str;
default =
if builtins.pathExists "${config.clanCore.clanDir}/${fact.config.path}" then
lib.strings.removeSuffix "\n" (builtins.readFile "${config.clanCore.clanDir}/${fact.config.path}")
if builtins.pathExists fact.config.path then
lib.strings.fileContents fact.config.path
else
null;
};