Skip to content

Commit

Permalink
Install py_mini_racer befora starting HA for my robot vacuum
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalyavolyn committed Nov 28, 2024
1 parent c25687a commit ab0301f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions modules/services/home-assistant/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{ lib, config, self, ... }:

let
cfg = config.modules.home-assistant;
in
{
options.modules.home-assistant.volumes = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Volumes to mount (needs /config)";
};

options.modules.home-assistant.addDbusVolume = lib.mkOption {
type = lib.types.bool;
description = "D-Bus is optional but required if you plan to use the Bluetooth integration";
default = true;
};

config = {
virtualisation.oci-containers.containers."homeassistant" = {
volumes = cfg.volumes ++ lib.optionals cfg.addDbusVolume [ "/run/dbus:/run/dbus:ro" ] ++ [ (builtins.toString ./. + ":/patches") ];
environment.TZ = config.time.timeZone;
image = "ghcr.io/home-assistant/home-assistant:stable";
extraOptions = [
"--network=host"
"--pull=newer"
];
entrypoint ="/patches/start.sh";
};

networking.firewall.allowedTCPPorts = [ 8123 ];
};
}
3 changes: 3 additions & 0 deletions modules/services/home-assistant/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

pip install py_mini_racer && exec /init

0 comments on commit ab0301f

Please sign in to comment.