Use rsync to manage esphome config directory
esphome tries to write build outputs to /nix/store which of course does not work as it is read-only.
This commit is contained in:
parent
9bd6400f39
commit
761831fdbe
1 changed files with 6 additions and 28 deletions
|
|
@ -14,8 +14,6 @@ let
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp -r * $out
|
cp -r * $out
|
||||||
ln -snf "${config.sops.secrets.esphome.path}" "$out/secrets.yaml"
|
ln -snf "${config.sops.secrets.esphome.path}" "$out/secrets.yaml"
|
||||||
ln -snf "${stateDir}/.esphome" "$out/.esphome"
|
|
||||||
ln -snf "${stateDir}/.gitignore" "$out/.gitignore"
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
esphomeParams =
|
esphomeParams =
|
||||||
|
|
@ -35,39 +33,19 @@ in
|
||||||
enable = true;
|
enable = true;
|
||||||
address = "127.0.0.1";
|
address = "127.0.0.1";
|
||||||
port = ports.esphome.tcp;
|
port = ports.esphome.tcp;
|
||||||
/*
|
package = pkgs.esphome.overrideAttrs (attrs: {
|
||||||
package = pkgs.esphome.overrideAttrs (o: o // {
|
makeWrapperArgs = attrs.makeWrapperArgs ++ [
|
||||||
propagatedBuildInputs = (o.propagatedBuildInputs or []) ++ [
|
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ]}"
|
||||||
pkgs.gcc
|
|
||||||
];
|
|
||||||
makeWrapperArgs = [
|
|
||||||
# platformio is used in esphomeyaml/platformio_api.py
|
|
||||||
# esptool is used in esphomeyaml/__main__.py
|
|
||||||
# git is used in esphomeyaml/writer.py
|
|
||||||
"--prefix PATH : ${lib.makeBinPath (with pkgs; [ platformio esptool_3 git gcc])}"
|
|
||||||
"--set ESPHOME_USE_SUBPROCESS ''"
|
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.services.esphome.serviceConfig = {
|
|
||||||
WorkingDirectory = lib.mkForce cfgdir;
|
|
||||||
ExecStart = lib.mkForce "${cfg.package}/bin/esphome dashboard ${esphomeParams} ${cfgdir}";
|
|
||||||
/*
|
|
||||||
Environment = [
|
|
||||||
"NIX_LD=/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/ld-linux-x86-64.so.2"
|
|
||||||
"NIX_LD_LIBRARY_PATH=/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib"
|
|
||||||
];
|
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
system.activationScripts.esphome-custom = {
|
system.activationScripts.esphome-custom = {
|
||||||
deps = [ "users" "groups" ];
|
deps = [ "users" "groups" ];
|
||||||
text = ''
|
text = ''
|
||||||
mkdir -p "${stateDir}/.esphome"
|
mkdir -p "${stateDir}/.esphome"
|
||||||
touch "${stateDir}/.gitignore"
|
${pkgs.rsync}/bin/rsync -a --delete "${cfgdir}/" "${stateDir}/"
|
||||||
chown esphome:esphome "${stateDir}/.esphome" "${stateDir}/.gitignore"
|
chown esphome:esphome "${stateDir}/"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue