Skip to content

Instantly share code, notes, and snippets.

@lheckemann
Created September 21, 2021 20:15
Show Gist options
  • Save lheckemann/6c72eb2d2afbebdfee6abe328afe1a4c to your computer and use it in GitHub Desktop.
Save lheckemann/6c72eb2d2afbebdfee6abe328afe1a4c to your computer and use it in GitHub Desktop.
{ pkgs, config, lib, ... }:
let
hassConfig = (pkgs.formats.yaml {}).generate "home-assistant-configuration" {
config = {};
frontend = {};
history = {};
image = {};
input_boolean = {};
input_datetime = {
good_morning = {
name = "LED Alarm";
has_time = true;
};
};
input_number = {};
input_select = {};
logbook = {};
mobile_app = {};
prometheus = {};
person = {};
ssdp = {};
sun = {};
system_health = {};
updater = {};
zeroconf = {};
zone = {};
http = {
use_x_forwarded_for = true;
trusted_proxies = config.vpn.hosts.sosiego.vpnIPs;
};
group = {};
automation = import ./hass/automations.nix {inherit lib;};
script = {};
scene = {};
};
in {
virtualisation.oci-containers.backend = "podman";
virtualisation.oci-containers.containers.home-assistant = {
image = "docker.io/homeassistant/home-assistant";
volumes = [
"/var/lib/hass:/config"
"/etc/localtime:/etc/localtime:ro"
"${hassConfig}:/config/configuration.yaml:ro"
];
extraOptions = ["--net=host" "--pull=always"];
};
systemd.services.podman-home-assistant.serviceConfig.RestartSec = "10s";
# Hack to get podman working with zfs
systemd.services.podman-home-assistant.path = [ config.boot.zfs.package ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment