35 lines
1.2 KiB
Nix
35 lines
1.2 KiB
Nix
{ config, lib, ... }: {
|
|
|
|
options.sysconfig.opts.virtualization.homeassistant = {
|
|
enable = lib.options.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
};
|
|
configvol = lib.options.mkOption {
|
|
type = lib.types.str;
|
|
default = "/ssd1/Home-Assistant/data:/config";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.sysconfig.opts.virtualization.homeassistant.enable {
|
|
|
|
virtualisation.oci-containers = {
|
|
backend = "docker";
|
|
containers.homeassistant = {
|
|
autoStart = true;
|
|
ports = [ "8123:8123" ];
|
|
volumes = [
|
|
config.sysconfig.opts.virtualization.homeassistant.configvol
|
|
"/run/dbus:/run/dbus:ro"
|
|
];
|
|
environment.TZ = "America/Chicago";
|
|
image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
|
|
extraOptions = [
|
|
"--network=host"
|
|
#"--device=/dev/ttyACM0:/dev/ttyACM0" # Use this for external devices e.g. zigbee
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|