openhab: deploy on stinger #732
No files matched your search
@@ -17,6 +17,7 @@
|
|||||||
jellyfin = 216;
|
jellyfin = 216;
|
||||||
radicale = 401;
|
radicale = 401;
|
||||||
homebox = 402;
|
homebox = 402;
|
||||||
|
openhab = 403;
|
||||||
|
|
||||||
## Consistent People
|
## Consistent People
|
||||||
jake = 1000;
|
jake = 1000;
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
jellyfin = 216;
|
jellyfin = 216;
|
||||||
radicale = 401;
|
radicale = 401;
|
||||||
homebox = 402;
|
homebox = 402;
|
||||||
|
openhab = 403;
|
||||||
|
|
||||||
## Consistent Groups
|
## Consistent Groups
|
||||||
mediaaccess = 1200;
|
mediaaccess = 1200;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ in
|
|||||||
mastodon = "";
|
mastodon = "";
|
||||||
matrix = "boron.cx.${config.ogygia.domain}";
|
matrix = "boron.cx.${config.ogygia.domain}";
|
||||||
mosquitto = "stinger.pop.${config.ogygia.domain}";
|
mosquitto = "stinger.pop.${config.ogygia.domain}";
|
||||||
|
openhab = "stinger.pop.${config.ogygia.domain}";
|
||||||
nix-builder = [
|
nix-builder = [
|
||||||
"slider.pop.${config.ogygia.domain}"
|
"slider.pop.${config.ogygia.domain}"
|
||||||
"boron.cx.${config.ogygia.domain}"
|
"boron.cx.${config.ogygia.domain}"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"ghcr.io/chia-network/chia": "2.5.6"
|
"ghcr.io/chia-network/chia": "2.5.6",
|
||||||
|
"openhab/openhab": "5.1.0.M1-alpine"
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
./matrix
|
./matrix
|
||||||
./mosquitto.nix
|
./mosquitto.nix
|
||||||
./nix-builder
|
./nix-builder
|
||||||
|
./openhab
|
||||||
./ollama.nix
|
./ollama.nix
|
||||||
./privatebin.nix
|
./privatebin.nix
|
||||||
./radicale.nix
|
./radicale.nix
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.custom.services.openhab;
|
||||||
|
imageName = "openhab/openhab";
|
||||||
|
version = config.custom.oci-containers.versions."${imageName}";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.custom.services.openhab = {
|
||||||
|
enable = lib.mkEnableOption "openhab";
|
||||||
|
|
||||||
|
dataDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/var/lib/openhab";
|
||||||
|
description = "OpenHAB data directory";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
# Override data directory for impermanence
|
||||||
|
custom.services.openhab.dataDir = lib.mkIf config.custom.impermanence.enable
|
||||||
|
(lib.mkOverride 999 "${config.custom.impermanence.base}/services/openhab");
|
||||||
|
|
||||||
|
# Create user and group
|
||||||
|
users.users.openhab = {
|
||||||
|
group = "openhab";
|
||||||
|
home = cfg.dataDir;
|
||||||
|
createHome = true;
|
||||||
|
isSystemUser = true;
|
||||||
|
uid = config.ids.uids.openhab;
|
||||||
|
};
|
||||||
|
users.groups.openhab = {
|
||||||
|
gid = config.ids.gids.openhab;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create data directories
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${cfg.dataDir} 0755 openhab openhab - -"
|
||||||
|
"d ${cfg.dataDir}/conf 0755 openhab openhab - -"
|
||||||
|
"d ${cfg.dataDir}/userdata 0755 openhab openhab - -"
|
||||||
|
"d ${cfg.dataDir}/addons 0755 openhab openhab - -"
|
||||||
|
];
|
||||||
|
|
||||||
|
# OpenHAB systemd service
|
||||||
|
systemd.services.openhab = {
|
||||||
|
description = "OpenHAB Home Automation";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "10";
|
||||||
|
User = "openhab";
|
||||||
|
Group = "openhab";
|
||||||
|
ExecStart = lib.strings.concatStringsSep " " [
|
||||||
|
"${pkgs.podman}/bin/podman run"
|
||||||
|
"--rm"
|
||||||
|
"--name openhab"
|
||||||
|
"--publish 28457:8080"
|
||||||
|
"--volume ${cfg.dataDir}/conf:/openhab/conf"
|
||||||
|
"--volume ${cfg.dataDir}/userdata:/openhab/userdata"
|
||||||
|
"--volume ${cfg.dataDir}/addons:/openhab/addons"
|
||||||
|
"--volume /etc/localtime:/etc/localtime:ro"
|
||||||
|
"--env OPENHAB_HTTP_PORT=8080"
|
||||||
|
"--env EXTRA_JAVA_OPTS='-Duser.timezone=Europe/London'"
|
||||||
|
"${imageName}:${version}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Caddy reverse proxy configuration
|
||||||
|
services.caddy = {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."openhab.${config.ogygia.domain}" = {
|
||||||
|
listenAddresses = [ config.custom.dns.nebula.ipv4 ];
|
||||||
|
extraConfig = ''
|
||||||
|
reverse_proxy http://localhost:28457
|
||||||
|
|
||||||
|
tls {
|
||||||
|
ca https://ca.${config.ogygia.domain}:8443/acme/acme/directory
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIEnTCCA4WgAwIBAgIURgWjAO905WSSkvNQjkqI9b9fLmgwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwgYsxCzAJBgNVBAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMTQw
|
||||||
|
MgYDVQQLEytDbG91ZEZsYXJlIE9yaWdpbiBTU0wgQ2VydGlmaWNhdGUgQXV0aG9y
|
||||||
|
aXR5MRYwFAYDVQQ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DVR0fBDEwLzAt
|
||||||
|
oCugKYYnaHR0cDovL2NybC5jbG91ZGZsYXJlLmNvbS9vcmlnaW5fY2EuY3JsMA0G
|
||||||
|
CSqGSIb3DQEBCwUAA4IBAQAFAItswRSB1AYWosQpMAGKLGp9XuDT460eW4wpUDmV
|
||||||
|
zcu1xO56WxXRsiuXKy4aT6m3tyofe0i51vVdlYb7BXWko13MUpeLyjre5Hobs66V
|
||||||
|
hE66GJ8T4ptYoMm+NsM1oioeIIPtXYjiWRyMzhHRWSqeCuGrCw4SjJfoVTzDI5Gn
|
||||||
|
swq8i3lIC4TyfzHHRibX3hCHTDcqr/IhV9O1X0hKTFiF6bsEtv3LKaGWdBoZ/K45
|
||||||
|
V4u93w0mOZ5mLlgkCqeUiQlnKTzwCZZkRmevxBbw5ReDx+cY9qKN3R7xjjjmcXuZ
|
||||||
|
2PBkVt6FXixhMu+GAHnOd6gbGtomuQw53QzHrL38hIvL
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -31,6 +31,7 @@ in
|
|||||||
"gitea.hillion.co.uk"
|
"gitea.hillion.co.uk"
|
||||||
"homeassistant.hillion.co.uk"
|
"homeassistant.hillion.co.uk"
|
||||||
"links.hillion.co.uk"
|
"links.hillion.co.uk"
|
||||||
|
"openhab.hillion.co.uk"
|
||||||
"pastes.hillion.co.uk"
|
"pastes.hillion.co.uk"
|
||||||
"status.jakehillion.me"
|
"status.jakehillion.me"
|
||||||
])
|
])
|
||||||
@@ -82,6 +83,10 @@ in
|
|||||||
tls ${./certs/homeassistant.hillion.co.uk.pem} ${config.age.secrets."caddy/homeassistant.hillion.co.uk.pem".path}
|
tls ${./certs/homeassistant.hillion.co.uk.pem} ${config.age.secrets."caddy/homeassistant.hillion.co.uk.pem".path}
|
||||||
reverse_proxy http://${locations.services.homeassistant}:8123
|
reverse_proxy http://${locations.services.homeassistant}:8123
|
||||||
'';
|
'';
|
||||||
|
"openhab.hillion.co.uk".extraConfig = ''
|
||||||
|
tls ${./certs/openhab.hillion.co.uk.pem} ${config.age.secrets."caddy/openhab.hillion.co.uk.pem".path}
|
||||||
|
reverse_proxy http://${locations.services.openhab}:8080
|
||||||
|
'';
|
||||||
"gitea.hillion.co.uk".extraConfig = ''
|
"gitea.hillion.co.uk".extraConfig = ''
|
||||||
tls ${./certs/gitea.hillion.co.uk.pem} ${config.age.secrets."caddy/gitea.hillion.co.uk.pem".path}
|
tls ${./certs/gitea.hillion.co.uk.pem} ${config.age.secrets."caddy/gitea.hillion.co.uk.pem".path}
|
||||||
reverse_proxy http://${locations.services.gitea}:3000
|
reverse_proxy http://${locations.services.gitea}:3000
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ in
|
|||||||
"secrets/certs/gitea.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
"secrets/certs/gitea.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
"secrets/certs/homeassistant.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
"secrets/certs/homeassistant.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
"secrets/certs/links.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
"secrets/certs/links.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
|
"secrets/certs/openhab.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
"secrets/certs/pastes.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
"secrets/certs/pastes.hillion.co.uk.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
"secrets/certs/status.jakehillion.me.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
"secrets/certs/status.jakehillion.me.pem.age".publicKeys = jake_users ++ [ neb.cx.boron ];
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user