homeassistant: support for python_script automation
This commit is contained in:
parent
9c6f9c4068
commit
8420dc923e
1 changed files with 28 additions and 0 deletions
|
@ -62,6 +62,17 @@ let
|
||||||
lovelace.mode = "yaml";
|
lovelace.mode = "yaml";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#pythonScripts = pkgs.runCommand "python_scripts" {
|
||||||
|
# nativeBuildInputs = [ pkgs.python3 ];
|
||||||
|
# scripts = cfg.pythonScripts;
|
||||||
|
#} ''
|
||||||
|
# mkdir $out
|
||||||
|
# for s in $scripts; do
|
||||||
|
# echo "checking syntax of $s"
|
||||||
|
# python -m py_compile "$s"
|
||||||
|
# ln -s "$s" "$out/$(basename $s"
|
||||||
|
# done
|
||||||
|
#'';
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with maintainers; [ dotlambda ];
|
meta.maintainers = with maintainers; [ dotlambda ];
|
||||||
|
|
||||||
|
@ -214,6 +225,17 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pythonScripts = mkOption {
|
||||||
|
#default = [];
|
||||||
|
#type = types.listOf types.path;
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.path;
|
||||||
|
description = ''
|
||||||
|
List of python scripts to use in the <literal>python_scripts</literal> integration.
|
||||||
|
Also see in the <link xlink:href="https://www.home-assistant.io/integrations/python_script">Homeassistant documentation</link>
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
openFirewall = mkOption {
|
openFirewall = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
@ -224,6 +246,12 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = mkIf (cfg.pythonScripts != null) [
|
||||||
|
"L+ ${cfg.configDir}/python_scripts - - - - ${cfg.pythonScripts}"
|
||||||
|
];
|
||||||
|
|
||||||
|
services.home-assistant.config.python_script = mkIf (cfg.pythonScripts != null) {};
|
||||||
|
|
||||||
systemd.services.home-assistant = {
|
systemd.services.home-assistant = {
|
||||||
description = "Home Assistant";
|
description = "Home Assistant";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
|
|
Loading…
Reference in a new issue