nixos/home-assistant: support extraArgs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, utils, ... }:
|
||||
|
||||
let
|
||||
inherit (lib)
|
||||
@@ -32,6 +32,10 @@ let
|
||||
unique
|
||||
;
|
||||
|
||||
inherit (utils)
|
||||
escapeSystemdExecArgs
|
||||
;
|
||||
|
||||
cfg = config.services.home-assistant;
|
||||
format = pkgs.formats.yaml {};
|
||||
|
||||
@@ -130,6 +134,15 @@ in {
|
||||
# https://github.com/home-assistant/architecture/blob/master/adr/0012-define-supported-installation-method.md#decision
|
||||
enable = mkEnableOption "Home Assistant. Please note that this installation method is unsupported upstream";
|
||||
|
||||
extraArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
example = [ "--debug" ];
|
||||
description = ''
|
||||
Extra arguments to pass to the hass executable.
|
||||
'';
|
||||
};
|
||||
|
||||
configDir = mkOption {
|
||||
default = "/var/lib/hass";
|
||||
type = types.path;
|
||||
@@ -695,8 +708,14 @@ in {
|
||||
"zwave_js"
|
||||
];
|
||||
in {
|
||||
ExecStart = "${package}/bin/hass --config '${cfg.configDir}'";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||
ExecStart = escapeSystemdExecArgs ([
|
||||
(lib.getExe package)
|
||||
"--config" cfg.configDir
|
||||
] ++ cfg.extraArgs);
|
||||
ExecReload = (escapeSystemdExecArgs [
|
||||
(lib.getExe' pkgs.coreutils "kill")
|
||||
"-HUP"
|
||||
]) + " $MAINPID";
|
||||
User = "hass";
|
||||
Group = "hass";
|
||||
WorkingDirectory = cfg.configDir;
|
||||
|
||||
Reference in New Issue
Block a user