parent
e82b9d5306
commit
9dee168383
5 changed files with 57 additions and 38 deletions
nixosModules/esphome-plus
|
@ -37,7 +37,7 @@
|
|||
in {
|
||||
name = "${name}.yaml";
|
||||
file = pkgs.runCommandLocal "${name}.yaml" {} ''
|
||||
cp ${format.generate "${name}.yaml" filteredConfig} $out
|
||||
cp ${format.generate name filteredConfig} $out
|
||||
sed -i -e "s/'\!\([a-z_]\+\) \(.*\)'/\!\1 \2/;s/^\!\!/\!/;" $out
|
||||
sed -i 's/ {}//g' $out
|
||||
'';
|
||||
|
@ -49,6 +49,11 @@ in {
|
|||
type = with types; attrsOf anything;
|
||||
};
|
||||
|
||||
secretsFile = mkOption {
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
};
|
||||
|
||||
deleteUnmanaged = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
|
@ -74,6 +79,8 @@ in {
|
|||
mkdir -p ${stateDir}
|
||||
fi
|
||||
|
||||
${optionalString (cfg.secretsFile != null) ''cp -f "$(realpath "${cfg.secretsFile}")" ${stateDir}/secrets.yaml''}
|
||||
|
||||
${optionalString cfg.deleteUnmanaged ''find ${stateDir} -name "*.yaml" ! -name "secrets.yaml" -delete''}
|
||||
|
||||
${concatMapStringsSep
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue