Services are ready.

This commit is contained in:
Raphaël Numbus
2026-02-22 12:04:19 +01:00
parent 40265e8c81
commit 2e16ac3711
10 changed files with 335 additions and 267 deletions
+19 -11
View File
@@ -3,15 +3,17 @@
with lib;
let
homeAssistantVersion = "2026.2.3";
mqttVersion = "2.1-alpine";
helper = import ./lib.nix { inherit config pkgs lib; };
cfg = config.numbus.services.home-assistant;
in
helper.mkPodmanService {
name = "home-assistant";
description = "Home Assistant, libre house control and much more";
defaultPort = "8123";
name = "home-assistant";
pod = "home-assistant";
defaultPort = "8123";
dataDir = false;
extraOptions = {
@@ -23,14 +25,11 @@ helper.mkPodmanService {
};
};
extraConfig = {
};
# Compose file good
composeText = ''
services:
home-assistant:
image: ghcr.io/home-assistant/home-assistant:latest
image: ghcr.io/home-assistant/home-assistant:${homeAssistantVersion}
container_name: home-assistant
hostname: home-assistant
networks:
@@ -38,26 +37,35 @@ helper.mkPodmanService {
ports:
- "${cfg.port}:8123/tcp"
volumes:
- ${cfg.configDir}:/config
- ${cfg.configDir}/config:/config
- /etc/localtime:/etc/localtime:ro
- /run/dbus:/run/dbus:ro
${lib.optionalString (cfg.devices != []) ''
devices:
${lib.concatStringsSep "\n" (map (d: " - \"${d}\"") cfg.devices)}
''}
security_opt:
- no-new-privileges:true
cap_drop:
- NET_RAW
restart: unless-stopped
home-assistant-mqtt:
image: docker.io/library/eclipse-mosquitto:latest
image: docker.io/library/eclipse-mosquitto:${mqttVersion}
container_name: home-assistant-mqtt
hostname: home-assistant-mqtt
user: '1000:1000'
networks:
home-assistant:
volumes:
- /mnt/config/mosquitto:/mosquitto
- ${cfg.configDir}/mqtt:/mosquitto
security_opt:
- no-new-privileges:true
cap_drop:
- NET_RAW
restart: unless-stopped
networks:
home-assistant:
name: home-assistant
driver: bridge
'';
}
}